Core applications

MarMix database model

Complete database model of MarMix

Customers

The billing app is intended to support the commercial part of MarMix. Customers, users, credits, etc. are managed through this app.

class customers.models.Customer(*args, **kwargs)[source]

A customer is the entity who is contractually linked to MarMix. It’s usually a Higher Ed institution. Users are members of customers’ organizations.

Parameters:
  • id (AutoField) – Id
  • created (CreationDateTimeField) – Created
  • modified (ModificationDateTimeField) – Modified
  • name (CharField) – Customer’s name, usually a higher ed institution
  • short_code (CharField) – This code is used to create simulation identification code in the user interface

Simulations

Simulations are games that are run by a teacher during a specific class. A simulation can be run in parallel with an ERPsim game or in standalone mode. This app is used to store the configuration parameters of each simulation.

Simulations

Stocks

Stocks are unique in a given simulation.

class stocks.models.Order(*args, **kwargs)[source]

Orders are made by teams and posted in the order book. They are then processed by the order manager. BID is the highest price that a buyer is willing to pay for a stock. ASK is the lowest price that a seller is willing to accept for a stock.

Parameters:
  • id (AutoField) – Id
  • stock_id (ForeignKey to Stock) – Related stock
  • team_id (ForeignKey to Team) – Team which placed the order
  • order_type (CharField) – The type of order (bid/ask)
  • quantity (IntegerField) – Quantity ordered. If the total quantity can not be provided, a new order will be created with the balance
  • price (DecimalField) – Price tag for one stock. If NULL, best available price
  • created_at (DateTimeField) – Creation of the order
  • transaction_id (ForeignKey to Transaction) – Related transaction
class stocks.models.Quote(*args, **kwargs)[source]

Quotes are the price of a given stock at a certain time.

Parameters:
  • id (AutoField) – Id
  • stock_id (ForeignKey to Stock) – Related stock
  • price (DecimalField) – Current stock price
  • timestamp (DateTimeField) – Timestamp of the quote
class stocks.models.Stock(*args, **kwargs)[source]

Stocks are shares of a company that are automatically generated during the simulation setup.

Parameters:
  • id (AutoField) – Id
  • created (CreationDateTimeField) – Created
  • modified (ModificationDateTimeField) – Modified
  • simulation_id (ForeignKey to Simulation) – Related simulation
  • symbol (CharField) – Symbol of the stock (4 chars)
  • name (CharField) – Full name of the stock
  • description (TextField) – Description of the stock (HTML)
  • quantity (IntegerField) – Total quantity of stocks in circulation
class stocks.models.Transaction(*args, **kwargs)[source]

Transactions are the result of order placed that are fulfilled.

Parameters:
  • id (AutoField) – Id
  • simulation_id (ForeignKey to Simulation) – Related simulation
  • fulfilled_at (DateTimeField) – Fulfillment date
  • transaction_type (CharField) – The type of transaction
class stocks.models.TransactionLine(*args, **kwargs)[source]

TransactionLine(id, transaction_id, stock_id, team_id, quantity, price, amount, asset_type)

Parameters:
  • id (AutoField) – Id
  • transaction_id (ForeignKey to Transaction) – Related transaction
  • stock_id (ForeignKey to Stock) – Related stock
  • team_id (ForeignKey to Team) – Team
  • quantity (IntegerField) – Quantity
  • price (DecimalField) – Price tag for one stock
  • amount (DecimalField) – Total amount (signed)
  • asset_type (CharField) – The type of asset
stocks.models.process_order(simulation, sell_order, buy_order, quantity)[source]

Fulfill two matching orders.

Note

This is called by check_matching_orders()

Parameters:
  • simulation – A simulation object.
  • sell_order – An order object (sell).
  • buy_order – An order object (buy).
  • quantity – The quantity to exchange (could be a partial fulfillment).
Returns:

Nothing.

Tickers

This is a template app that should get a great new description...

class tickers.models.Ticker(*args, **kwargs)[source]

Ticker(id, created, modified, simulation_id, nb_companies, initial_value, state, with_drift, nb_rounds, nb_days, day_duration, dividend_payoff_rate, transaction_costs, interest_rate, fixed_interest_rate)

Parameters:
  • id (AutoField) – Id
  • created (CreationDateTimeField) – Created
  • modified (ModificationDateTimeField) – Modified
  • simulation_id (OneToOneField to Simulation) – Related simulation
  • nb_companies (IntegerField) – Number of real/simulated companies
  • initial_value (IntegerField) – Initial value of the companies (discounted cash flow). The exact value is randomized.
  • state (IntegerField) – Current state of this ticker
  • with_drift (BooleanField) – Advanced simulations display the drift
  • nb_rounds (IntegerField) – Number of simulation rounds
  • nb_days (IntegerField) – Number of days in a simulation round
  • day_duration (IntegerField) – Duration of each simulation day in seconds
  • dividend_payoff_rate (DecimalField) – Payoff rate in percent. To disable dividend payoff, set to 0.00
  • transaction_costs (DecimalField) – Amount to be paid for one transaction. To disable transaction costs, set to 0.00
  • interest_rate (DecimalField) – Interest rate retributing portfolios. To disable retribution of cash, set to 0.00
  • fixed_interest_rate (BooleanField) – If fixed, the interest rate will not vary accross time
class tickers.models.TickerQuote(*args, **kwargs)[source]

Quotes are the price of a given stock at a certain time.

Parameters:
  • id (AutoField) – Id
  • stock_id (ForeignKey to TickerStock) – Related stock
  • price (DecimalField) – Current stock price
  • timestamp (DateTimeField) – Timestamp of the quote
class tickers.models.TickerStock(*args, **kwargs)[source]

Stocks are shares of a company that are automatically generated during the simulation setup.

Parameters:
  • id (AutoField) – Id
  • created (CreationDateTimeField) – Created
  • modified (ModificationDateTimeField) – Modified
  • ticker_id (ForeignKey to Ticker) – Related ticker
  • symbol (CharField) – Symbol of the stock (4 chars)
  • name (CharField) – Full name of the stock
  • description (TextField) – Description of the stock (HTML)
  • quantity (IntegerField) – Total quantity of stocks in circulation
class tickers.models.TickerTick(*args, **kwargs)[source]

Stocks are shares of a company that are automatically generated during the simulation setup.

Parameters:
  • id (AutoField) – Id
  • ticker_id (ForeignKey to Ticker) – Related ticker
  • timestamp (DateTimeField) – Timestamp of the tick
  • sim_round (IntegerField) – Current round
  • sim_day (IntegerField) – Current day

Users

class users.models.User(*args, **kwargs)[source]

User(id, password, last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined)

Parameters:
  • id (AutoField) – Id
  • password (CharField) – Password
  • last_login (DateTimeField) – Last login
  • is_superuser (BooleanField) – Designates that this user has all permissions without explicitly assigning them.
  • username (CharField) – Required. 30 characters or fewer. Letters, digits and @/./+/-/_ only.
  • first_name (CharField) – First name
  • last_name (CharField) – Last name
  • email (EmailField) – Email address
  • is_staff (BooleanField) – Designates whether the user can log into this admin site.
  • is_active (BooleanField) – Designates whether this user should be treated as active. Unselect this instead of deleting accounts.
  • date_joined (DateTimeField) – Date joined
class users.views.UserViewSet(**kwargs)[source]

This viewset automatically provides list and detail actions.

Table Of Contents

Previous topic

Deploy

This Page