KeyError: 'minute_askvol'

kk24100kk24100 Posts: 11

iam using below code snippet,

def on_minute_bar(self, event, md, order, service, account, bar):
    self.count += 1
    print md.L1.minute_askvol

I get below error,

am i missing something.
Traceback (most recent call last):
File "run_simulation.py", line 558, in
main(sys.argv[1:])
File "run_simulation.py", line 532, in main
results = simulator()
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1564072999421/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/engine.py", line 580, in call
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1564072999421/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/engine.py", line 769, in simulate
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1564072999421/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/context.py", line 1133, in fast_simulation_process_event
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1564072999421/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/context.py", line 584, in on_minute_bar
File "job/CQ2be0bd39718248c0a1658985e52f9036.py", line 22, in on_minute_bar
print md.L1.minute_askvol
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1564072999421/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/market.py", line 1806, in getattr
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1564072999421/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/market.py", line 140, in _get_by_index
File "/var/jenkins_home/miniconda/conda-bld/tradesim_1564072999421/_h_env_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placehold_placeho/lib/python2.7/site-packages/tradesim/level1.py", line 1106, in get
KeyError: 'minute_askvol'

Tagged:

Comments

  • ptunneyptunney Posts: 246

    Nothing wrong with it, should not throw an error. I have tested and it works ok.
    But note, those variables are intra minute and so only available in on_trade which is an Elite function. If you have run a number of backtests you should have received an email inviting you to upgrade to Elite if you wish.
    If you want that kind of data in on_minute you would access the bar or the daily values. See your other question in the forum.

    The following code works for me, if you have elite and switch it to on_trade you will see that you start getting values...

        def on_start(self, md, order, service, account): 
            self.count = 0
    
    #    def on_trade(self, event, md, order, service, account):
        def on_minute_bar(self, event, md, order, service, account, bar):
            self.count += 1
            print service.time_to_string(event.timestamp),md.L1.minute_askvol,md.L1.minute_bidvol,md.L1.minute_close,md.L1.minute_count,md.L1.minute_high,md.L1.minute_low,md.L1.minute_open,md.L1.minute_spread,md.L1.minute_start_timestamp,md.L1.minute_volume,md.L1.minute_vwap #     
    
  • kk24100kk24100 Posts: 11
    edited September 2019

    thanks for response. i have not got email inviting to upgrade to Elite. whats the process for this. can you please share a link

  • i got elite! thanks a lot

Sign In or Register to comment.