pylivetrader: VXX symbol is not tradable in paper trading mode

Steps to reproduce

in pylivetrader shell execute the following

In [1]: symbol('VXX')
Out[1]: Asset(f39bb659-b994-4b94-b791-16e979ccddbe, symbol=VXX, asset_name=VXX, exchange=BATS)
In [2]: data.can_trade([symbol('VXX')])
Out[2]: 
Equity(f39bb659-b994-4b94-b791-16e979ccddbe [VXX])    False
dtype: bool

Expected result Active and tradable VXX is returned with sid=‘273b92cc-8a5d-459a-81bd-981d8ed5f89a’

Additional context If I hardcode the active one that I get trough alpaca_trade_api

my_symbol = 'VXX'
my_sid = [(asset.id, asset.status) for asset in alpaca_assets if asset.symbol == my_symbol]
my_sid
[('273b92cc-8a5d-459a-81bd-981d8ed5f89a', 'active'),
 ('f39bb659-b994-4b94-b791-16e979ccddbe', 'inactive')]

the order still executes for inactive symbol. Which then makes rebalancing in my algo impossible, as order_target_percent method that I use returns incorrect amount of VXX as its checking against active sid.

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 17 (9 by maintainers)

Most upvoted comments

Hi, did a fix in the alpaca-trade-api. you need to install that specific branch since it will take some time until it will be in the master branch. just remember to switch back once it does. do this: pip install git+https://github.com/alpacahq/alpaca-trade-api-python@avoid_changing_date_as_ints

I missed last update. I will test this in next couple days starting today