INNER CODE UNIT · Python

lmt_price

AlexShakaev/backtesting_and_algotrading_options_with_Interactive_Brokers_API · main.py:179

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

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…