Module areixio.utils.objects

Classes

class AccountData (asset: str, exchange: Exchange, balance: float = 0, frozen: float = 0, available: float = 0, actual_balance: float = 0, actual_frozen: float = 0, actual_available: float = 0, initial_capital: float = 0, capital: float = 0, additional_capitals: dict = <factory>)

Account data contains information about balance, frozen and available.

Ancestors

Class variables

var actual_available : float
var actual_balance : float
var actual_frozen : float
var additional_capitals : dict
var asset : str
var available : float
var balance : float
var capital : float
var exchangeExchange
var frozen : float
var initial_capital : float

Methods

def add_balance(self, dt: Union[datetime.datetime, str], amount: float)
class AssetType (*args, **kwds)

Asset type.

Ancestors

  • enum.Enum

Class variables

var AMERICAN_OPTION
var BOND
var DATED_FUTURE
var EARN
var EQUITY
var ETF
var EUROPEAN_OPTION
var FOREX
var FORWARD
var FUND
var FUTURE
var FUTURES
var INDEX
var INVERSE_DATED_FUTURE
var INVERSE_FUTURE
var INVERSE_PERPETUAL
var LIQUID_SWAP
var OPTION
var PERPETUAL
var SAVING
var SPOT
var SPREAD
var STOCK
var WARRANT
class BarData (symbol: str, code: str, exchange: Exchange, datetime: datetime.datetime, asset_type: AssetType, interval: Interval = None, volume: float = 0.0, turnover: float = 0.0, open_interest: float = 0.0, open: float = 0.0, high: float = 0.0, low: float = 0.0, close: float = 0.0)

Candlestick bar data of a certain trading period.

Ancestors

Class variables

var asset_typeAssetType
var close : float
var code : str
var datetime : datetime.datetime
var exchangeExchange
var high : float
var intervalInterval
var low : float
var open : float
var open_interest : float
var symbol : str
var turnover : float
var volume : float
class BaseData

Any data object should inherit base data.

Subclasses

Methods

def get(self, k, default=None)
def to_dict(self, display=[])
def update(self, key, value)
def update_from_dict(self, item)
class Exchange (*args, **kwds)

Exchange.

Ancestors

  • enum.Enum

Class variables

var BINANCE
var BINGX
var BITGET
var BYBIT
var EQONEX
var FTX
var FUTU
var IBKR
var LOCAL
var OKX
var YAHOO
class ExecutionType (*args, **kwds)

Execution type.

Ancestors

  • enum.Enum

Class variables

var FUNDING
var LIQUIDATION
var SETTLE
var TRADE
class Interval (*args, **kwds)

Interval of bar data.

Ancestors

  • enum.Enum

Class variables

var DAILY
var HOUR
var MINUTE
var TICK
var WEEKLY
class OptionType (*args, **kwds)

Option type.

Ancestors

  • enum.Enum

Class variables

var CALL
var PUT
class OrderData (order_id: str, symbol: str, quantity: float, side: Side, position_side: PositionSide = PositionSide.NET, price: float = 0.0, stop_price: float = 0.0, trail_price: float = 0.0, trail_percent: float = 0.0, exchange: Exchange = Exchange.LOCAL, code: str = None, order_type: OrderType = None, asset_type: AssetType = None, status: Status = Status.NEW, commission: float = 0.0, commission_asset: str = None, executed_quantity: float = 0.0, init_quantity: float = 0.0, is_open: bool = None, created_at: datetime.datetime = None, updated_at: datetime.datetime = None, msg: str = '', ttl: str = 'GTC', oco: str = None)

Order data contains information for tracking lastest status of a specific order.

Ancestors

Class variables

var asset_typeAssetType
var code : str
var commission : float
var commission_asset : str
var created_at : datetime.datetime
var exchangeExchange
var executed_quantity : float
var init_quantity : float
var is_open : bool
var msg : str
var oco : str
var order_id : str
var order_typeOrderType
var position_sidePositionSide
var price : float
var quantity : float
var sideSide
var statusStatus
var stop_price : float
var symbol : str
var trail_percent : float
var trail_price : float
var ttl : str
var updated_at : datetime.datetime

Methods

def is_active(self) ‑> bool

Check if the order is active.

class OrderType (*args, **kwds)

Order type.

Ancestors

  • enum.Enum

Class variables

var HISTORY
var LIMIT
var MARKET
var OCO
var STOP
var STOPLIMIT
var UNRECOGNIZED
class PositionData (symbol: str, code: str, exchange: Exchange, asset_type: AssetType, quantity: float, frozen: float = 0.0, available: float = 0.0, avg_open_price: float = 0.0, prev_quantity: float = 0.0, actual_quantity: float = 0.0, actual_avg_open_price: float = 0.0, actual_realized_pnl: float = 0.0, actual_position_side: PositionSide = None, side: PositionSide = None, position_side: PositionSide = PositionSide.NET, created_at: datetime.datetime = None, updated_at: datetime.datetime = None, pnl: float = 0.0, realized_pnl: float = 0.0, unrealized_pnl: float = 0.0, market_value: float = 0.0, notional_value: float = 0.0, net_investment: float = 0.0, total_commission: float = 0.0, total_turnover: float = 0.0, latest_price: float = 0.0, weight: float = 0.0, weight_wo_cash: float = 0.0, liq_price: float = 0.0, leverage: float = 1.0, is_isolated: bool = False, position_margin: float = 0.0, initial_margin: float = 0.0, maintenance_margin: float = 0.0)

Positon data is used for tracking each individual position holding.

Ancestors

Class variables

var actual_avg_open_price : float
var actual_position_sidePositionSide
var actual_quantity : float
var actual_realized_pnl : float
var asset_typeAssetType
var available : float
var avg_open_price : float
var code : str
var created_at : datetime.datetime
var exchangeExchange
var frozen : float
var initial_margin : float
var is_isolated : bool
var latest_price : float
var leverage : float
var liq_price : float
var maintenance_margin : float
var market_value : float
var net_investment : float
var notional_value : float
var pnl : float
var position_margin : float
var position_sidePositionSide
var prev_quantity : float
var quantity : float
var realized_pnl : float
var sidePositionSide
var symbol : str
var total_commission : float
var total_turnover : float
var unrealized_pnl : float
var updated_at : datetime.datetime
var weight : float
var weight_wo_cash : float
class PositionSide (*args, **kwds)

Position side. For contracts only

NET: can hold either a long or a short position of a contract. Long/Short: can hold both long and short positions simultaneously of a contract.

Ancestors

  • enum.Enum

Class variables

var LONG
var NET
var SHORT
var UNRECOGNIZED
class Side (*args, **kwds)

Side of order/trade/position.

Ancestors

  • enum.Enum

Class variables

var BUY
var BUYCOVER
var SELL
var SHORTSELL
var UNRECOGNIZED
class Status (*args, **kwds)

Order status.

Ancestors

  • enum.Enum

Class variables

var AMENDED
var AMENDING
var CANCELED
var CANCELING
var FAILED
var FILLED
var FILLING
var LIQUIDATED
var NEW
var PARTIALLY_FILLED
var UNRECOGNIZED
class SymbolData (symbol: str, exchange: Exchange, code: str, asset_type: AssetType, size: float, pricetick: float, min_volume: float = 1, stop_supported: bool = False, net_position: bool = False, history_data: bool = False, option_strike: float = 0.0, option_underlying: str = '', option_type: OptionType = None, option_expiry: datetime.datetime = None, option_portfolio: str = '', option_index: str = '')

Symbol data contains basic information about each contract traded.

Ancestors

Class variables

var asset_typeAssetType
var code : str
var exchangeExchange
var history_data : bool
var min_volume : float
var net_position : bool
var option_expiry : datetime.datetime
var option_index : str
var option_portfolio : str
var option_strike : float
var option_typeOptionType
var option_underlying : str
var pricetick : float
var size : float
var stop_supported : bool
var symbol : str
class TickData (symbol: str, code: str, exchange: Exchange, datetime: datetime.datetime, asset_type: AssetType, volume: float = 0.0, turnover: float = 0.0, open_interest: float = 0.0, last_price: float = 0.0, open: float = 0.0, high: float = 0.0, low: float = 0.0, bid_price_1: float = 0.0, bid_price_2: float = 0.0, bid_price_3: float = 0.0, bid_price_4: float = 0.0, bid_price_5: float = 0.0, ask_price_1: float = 0.0, ask_price_2: float = 0.0, ask_price_3: float = 0.0, ask_price_4: float = 0.0, ask_price_5: float = 0.0, bid_volume_1: float = 0.0, bid_volume_2: float = 0.0, bid_volume_3: float = 0.0, bid_volume_4: float = 0.0, bid_volume_5: float = 0.0, ask_volume_1: float = 0.0, ask_volume_2: float = 0.0, ask_volume_3: float = 0.0, ask_volume_4: float = 0.0, ask_volume_5: float = 0.0, localtime: datetime.datetime = None)

Tick data contains information about: * last trade in market * orderbook snapshot * intraday market statistics.

Ancestors

Class variables

var ask_price_1 : float
var ask_price_2 : float
var ask_price_3 : float
var ask_price_4 : float
var ask_price_5 : float
var ask_volume_1 : float
var ask_volume_2 : float
var ask_volume_3 : float
var ask_volume_4 : float
var ask_volume_5 : float
var asset_typeAssetType
var bid_price_1 : float
var bid_price_2 : float
var bid_price_3 : float
var bid_price_4 : float
var bid_price_5 : float
var bid_volume_1 : float
var bid_volume_2 : float
var bid_volume_3 : float
var bid_volume_4 : float
var bid_volume_5 : float
var code : str
var datetime : datetime.datetime
var exchangeExchange
var high : float
var last_price : float
var localtime : datetime.datetime
var low : float
var open : float
var open_interest : float
var symbol : str
var turnover : float
var volume : float
class TradeData (order_id: str, symbol: str, code: str, quantity: float, side: Side, position_side: PositionSide = PositionSide.NET, action: str = None, price: float = 0.0, exchange: Exchange = Exchange.LOCAL, asset_type: AssetType = None, execution_type: ExecutionType = ExecutionType.TRADE, commission: float = 0.0, commission_asset: str = None, traded_at: datetime.datetime = None, actual_traded_at: datetime.datetime = None, gross_amount: float = 0.0, net_amount: float = 0.0, is_open: bool = None, avg_open_price: float = None, leverage: float = 1, pnl: float = 0.0, pnl_net: float = 0.0, roi: float = 0.0)

Trade data contains information for tracking lastest status of a specific order.

Ancestors

Class variables

var action : str
var actual_traded_at : datetime.datetime
var asset_typeAssetType
var avg_open_price : float
var code : str
var commission : float
var commission_asset : str
var exchangeExchange
var execution_typeExecutionType
var gross_amount : float
var is_open : bool
var leverage : float
var net_amount : float
var order_id : str
var pnl : float
var pnl_net : float
var position_sidePositionSide
var price : float
var quantity : float
var roi : float
var sideSide
var symbol : str
var traded_at : datetime.datetime