Models¶
Trading¶
Models here represents any interaction between a user and stocks
-
class
trading.models.
TradeBucket
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Same as trade but for buckets
-
class
trading.models.
TradeStock
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
A Trade represents a single exchange of a stock for money
Authentication¶
Models keeps track of all the persistent data around the user profile
-
class
authentication.models.
Profile
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Profile is an extension of
django.contrib.auth.models.User
, that allows us to store additional values per User.-
default_acc
()[source]¶ This method retrieves the default account for the profile. If none exists, a new one will be created with the name ‘default’.
Returns: The default trading.models.TradingAccount
.
-
-
class
authentication.models.
UserBank
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
The UserBank wraps a connection to Plaid. It stores the access token for the User. At the same time it also caches past queries to reduce initial load time.
-
current_balance
(update=True)[source]¶ Returns the latest balance for the bank account. If update is set, then the balance will be synced with the original bank account.
Parameters: update (bool) – Whether to sync with the remote bank account. Returns: float of the current balance for the account
-
-
authentication.models.
create_user_profile
(instance, created, **_)[source]¶ This method will be called every time a
django.contrib.auth.models.User
is saved. It will create aauthentication.models.Profile
to associate with the user.Parameters: - instance (
django.contrib.auth.models.User
) – The User instance that was saved. - created – True if the instance was just created.
- type – bool
- instance (
-
authentication.models.
save_user_profile
(instance, **_)[source]¶ This method ensures that the
authentication.models.Profile
is kept in sync with the User (django.contrib.auth.models.User
)Parameters: instance ( django.contrib.auth.models.User
) – The User instance that was saved.
Stocks¶
Models keeps track of all the persistent data around stocks
-
class
stocks.models.
DailyStockQuote
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
DailyStockQuote is one day in the performance of a stock, for example 2nd July GOOGL value is 281.31$
-
class
stocks.models.
InvestmentBucket
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
An investment bucket represents a collection of stocks to invest in
-
class
stocks.models.
InvestmentBucketDescription
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
An investment bucket represents a collection of stocks to invest in
-
class
stocks.models.
InvestmentStockConfiguration
(*args, **kwargs)[source]¶ Bases:
django.db.models.base.Model
Represents the configuration of how much of a stock to invest for a bucket