tradester package

Subpackages

Submodules

tradester.admin module

tradester.apps module

class tradester.apps.TradesterConfig(app_name, app_module)[source]

Bases: AppConfig

default_auto_field = 'django.db.models.BigAutoField'
name = 'tradester'

tradester.data_handling module

data_handling.py

This Python module holds functions to perform operations on data such as loading data to the database and processing the data. These functions are called by views when the backend receives HTTP requests.

Functions: fetch_stock_data()

tradester.data_handling.fetch_stock_data()[source]

tradester.models module

class tradester.models.Investment(*args, **kwargs)[source]

Bases: Model

A throwaway table used to demonstrate database integration. Used for the ‘Hello World’ demo.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

amount

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

investment_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
class tradester.models.Order(*args, **kwargs)[source]

Bases: Model

The Order table holds information about a user’s order to buy or sell a stock.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

get_next_by_order_time(*, field=<django.db.models.fields.DateTimeField: order_time>, is_next=True, **kwargs)
get_previous_by_order_time(*, field=<django.db.models.fields.DateTimeField: order_time>, is_next=False, **kwargs)
objects = <django.db.models.manager.Manager object>
order_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

order_time

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

order_type

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

price

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stock_symbol

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

stock_symbol_id
username

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

username_id
class tradester.models.Portfolio(*args, **kwargs)[source]

Bases: Model

The Portfolio table instance represents a users stock portfolio. It links a specific instance of a portfolio to a user

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

objects = <django.db.models.manager.Manager object>
portfolio_id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

portfolio_stock_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

username

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

username_id
class tradester.models.Portfolio_stock(*args, **kwargs)[source]

Bases: Model

The Portfolio_Stock table holds information about the quantity and purchase price of a stock in a user’s portfolio.

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

id

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
portfolio_id

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

portfolio_id_id
purchase_price

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

quantity

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stock_symbol

Accessor to the related object on the forward side of a many-to-one or one-to-one (via ForwardOneToOneDescriptor subclass) relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Child.parent is a ForwardManyToOneDescriptor instance.

stock_symbol_id
class tradester.models.Stock(*args, **kwargs)[source]

Bases: Model

The Stock table holds instances of a specific stock and data used to evaluate those stocks

exception DoesNotExist

Bases: ObjectDoesNotExist

exception MultipleObjectsReturned

Bases: MultipleObjectsReturned

avg_daily_volume

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

beta

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

company_name

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

current_price

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

dividend_yield

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

earnings_per_share

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

high_52

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

low_52

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

market_cap

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

objects = <django.db.models.manager.Manager object>
order_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

portfolio_stock_set

Accessor to the related objects manager on the reverse side of a many-to-one relation.

In the example:

class Child(Model):
    parent = ForeignKey(Parent, related_name='children')

Parent.children is a ReverseManyToOneDescriptor instance.

Most of the implementation is delegated to a dynamically defined manager class built by create_forward_many_to_many_manager() defined below.

price_to_earnings_ratio

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

sector

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

stock_symbol

A wrapper for a deferred-loading field. When the value is read from this object the first time, the query is executed.

tradester.tests module

tradester.urls module

tradester.views module

tradester.views.get_investment(request, token)[source]

View to receive the investment data for a user

param request: the request object

param token: session token attached to signed-in user

return: HttpResponse object with data to display in frontend or error message “not signed in”

rtype: HttpResponse

tradester.views.get_stock_data(request, _stock_symbol)[source]

View to get data on a specified stock

param request: the request object

type request: HttpRequest

param _symbol: symbol of the stock to retrieve data for

type _symbol: str

return: HttpResponse object with JSON data of stock information or error message

rtype: HttpResponse

tradester.views.index(request)[source]

:template:`path/to/template.html`

tradester.views.register(request, _username, _password)[source]

View to register a new user account

param request: the request object

type request: HttpRequest

param _username: inputted username

type _username: str

param _password: inputted password

type _password: str

return: HttpResponse object with ‘Account creation successful’ or ‘Username is already taken’

rtype: HttpResponse

tradester.views.save_investment(request)[source]
tradester.views.sign_in(request, _username: str, _password: str) HttpResponse[source]

View to sign in a user

param request: the request object

param _username: inputted username

param _password: inputted password

return: HttpResponse object with ‘Sign in successful’ or ‘Invalid login credentials’

rtype: HttpResponse

Module contents