Alpaca¶
Documentation¶
- class lumibot.brokers.alpaca.Alpaca(config, max_workers=20, chunk_size=100, connect_stream=True)¶
Bases:
lumibot.data_sources.alpaca_data.AlpacaData
,lumibot.brokers.broker.Broker
Inherit AlpacaData first and all the price market methods than inherits broker
- ASSET_TYPE_MAP = {'forex': [], 'future': [], 'option': [], 'stock': ['us_equity']}¶
- cancel_order(order)¶
Cancel an order
- get_time_to_close()¶
How much time in seconds remains until the market closes?
Return the remaining time for the market to closes in seconds
- Parameters
None –
- Returns
Number of seconds until close.
- Return type
int
Examples
If it is 1400 and the market closes at 1600, then there are 7,200 seconds until the market closes.
- get_time_to_open()¶
How much time in seconds remains until the market next opens?
Return the remaining time for the market to open in seconds
- Parameters
None –
- Returns
Number of seconds until open.
- Return type
int
Examples
If it is 0830 and the market next opens at 0930, then there are 3,600 seconds until the next market open.
- get_timestamp()¶
Returns the current UNIX timestamp representation from Alpaca
- Parameters
None –
- Returns
Sample unix timestamp return value: 1612172730.000234
- Return type
int
- is_market_open()¶
Determines if the market is open.
- Parameters
None –
- Returns
True if market is open, false if the market is closed.
- Return type
boolean
- map_asset_type(type)¶