INNER CODE UNIT · Python

lmt_price

AlexShakaev/backtesting_and_algotrading_options_with_Interactive_Brokers_API · main.py:214

                lmt_price = round(lmt_price + 0.01, 2)                 
               
                if not client.filled and client.error_code != 104:
                    print(f'Adjusting to ask... Placing order with lmt price {lmt_price}')               
                    place_order(client, order_id, bag_con, lmt_price) 
                    time.sleep(15) 
                else:
                    print("Order is filled")
                    break  
                                                     
            print('Succesfully placed order!\n') 
            client.entered = True   
            client.filled = False            
            trade_time, comm, premium = get_trade_details(client)              
            print(f'Bought SPY call spread at {trade_time : %Y-%m-%d %X}, debit - {premium}, commission - {comm}\n')
            print(client.acc_df)
            client.reqAccountUpdates(False, "")
                                    

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…