-
-
Notifications
You must be signed in to change notification settings - Fork 1
tradeTypes
Ben Bell edited this page Nov 15, 2024
·
1 revision
The tradeTypes.py module defines the trade types, exceptions, and data classes used in the backtesting framework.
An enumeration of the different types of trades.
-
BUY: Buy trade -
SELL: Sell trade -
SHORT_SELL: Short sell trade -
STOP: Stop order -
COVER: Cover short position -
GTC: Good-Till-Canceled order -
Cancel: Cancel order -
MARKET_BUY: Market buy order -
MARKET_SELL: Market sell order -
SHORT_COVER: Short cover order -
LIMIT_BUY: Limit buy order -
LIMIT_SELL: Limit sell order
Raised when there are insufficient funds to execute a trade.
Raised when there are insufficient shares to execute a sell trade.
Raised when an invalid commission type is specified.
Raised when an invalid order is specified.
Raised when there is an error with a short position.
Represents a holding in the portfolio.
-
tradeType(TradeType): The type of trade. -
ticker(str): The ticker symbol of the asset. -
commission(float): The commission for the trade. -
executedSuccessfully(bool): Whether the trade was executed successfully. -
numShares(int): The number of shares. -
totalCost(float): The total cost of the trade. -
entryPrice(float): The entry price of the trade. -
shortPosition(bool): Whether the holding is a short position.
Represents a transaction in the backtest.
-
tradeType(TradeType): The type of trade. -
ticker(str): The ticker symbol of the asset. -
commission(float): The commission for the trade. -
executedSuccessfully(bool): Whether the trade was executed successfully. -
numShares(int): The number of shares. -
pricePerShare(float): The price per share. -
totalCost(float): The total cost of the trade. -
date(datetime): The date of the transaction. -
profitLoss(float): The profit or loss from the trade. -
notes(str): Additional notes about the transaction.
Represents an order in the backtest.
-
tradeType(TradeType): The type of trade. -
ticker(str): The ticker symbol of the asset. -
numShares(int): The number of shares. -
targetPrice(float): The target price for the order. -
duration(str): The duration of the order ('DAY' or 'GTC'). -
orderDate(datetime): The date the order was placed. -
active(bool): Whether the order is active. -
limitPrice(Optional[float]): The limit price for the order (if applicable).