Module engine
Classes
class Trade (security: str, security_price: float, amount: int, amount_borrowed: int, transaction_id: str, timestamp: datetime.datetime, trade_type: TradeType, order: TradeOrder)-
Helper class that provides a standard way to create an ABC using inheritance.
Parent
- abc.ABC
Static methods
def load(data: dict)-
This method loads a trade object from a dictionary.
Args:
data: The dictionary containing the object stateReturns:
- The object
Methods
def export(self) ‑> dict-
This method export the trade object to a JSONable dictionary.
Returns:
- The object state as a dictionary
def getCost(self) ‑> float-
This method calculates the upfront cost of the trade. It ignores the cost of borrowing the securities.
Note
It doesn't include transaction costs nor the cost of borrowing the securities.
Returns:
- The upfront cost of the trade
class TradeOrder (timestamp: datetime.datetime, security: str, security_price_limit: Tuple[Optional[float], Optional[float]], amount: int, amount_borrowed: int, trade_type: TradeType, expiry: Optional[datetime.datetime])-
Helper class that provides a standard way to create an ABC using inheritance.
Parent
- abc.ABC
Static methods
def load(data: dict)-
This method loads a trade order object from a dictionary.
Args:
data: The dictionary containing the object stateReturns:
- The object
Methods
def export(self) ‑> dict-
This method export the trade order object to a JSONable dictionary.
Returns:
- The object state as a dictionary
class TradeType (*args, **kwds)-
Create a collection of name/value pairs.
Example enumeration:
>>> class Color(Enum): ... RED = 1 ... BLUE = 2 ... GREEN = 3Access them by:
- attribute access:
Color.RED
- value lookup:
Color(1)
- name lookup:
Color['RED']
Enumerations can be iterated over, and know how many members they have:
>>> len(Color) 3>>> list(Color) [<Color.RED: 1>, <Color.BLUE: 2>, <Color.GREEN: 3>]Methods can be added to enumerations, and members can have their own attributes – see the documentation for details.
Parent
- enum.Enum
Class variables
var BuyLongvar BuyShortvar SellLongvar SellShort
Static methods
def available()