I have a text file with 2 lines
fyers.place_orders(token = token, data = {"symbol" : "NSE:SBIN-EQ","qty" : 1,"type" : 2,"side" : 1,"productType" : "INTRADAY","limitPrice" : 0,"stopPrice" : 0,"disclosedQty" : 0,"validity" : "DAY","offlineOrder" : "False","stopLoss" : 0,"takeProfit" : 0})
fyers.place_orders(token = token, data = {"symbol" : "BSE:SBIN-EQ","qty" : 1,"type" : 2,"side" : 1,"productType" : "INTRADAY","limitPrice" : 0,"stopPrice" : 0,"disclosedQty" : 0,"validity" : "DAY","offlineOrder" : "False","stopLoss" : 0,"takeProfit" : 0})
These are basically the command required to fire orders to the Fyers Api for trading.
So my goal is to connect to the api and run these lines one by one. Here is my code
import sys
import os
import copy
import math
from fyers_api import accessToken
from fyers_api import fyersModel
token = 'gAAAAABern0tlSRuURXn3v0FB8M4MZ7z2PEIEfuJzpxEgkPYaVkDSVZ9vVp60qRI-Sm711-g2H6fcZRJiEKKqXyzyD9OdvnfjBuNac3iB1MX18o5ufDMdHE=&user_id=DDDDDD'
is_async = False#(By default False, Change to True for asnyc API calls.)
fyers = fyersModel.FyersModel(is_async)
my_profile = fyers.get_profile(token=token)
print(my_profile)
my_funds = fyers.funds(token=token)
print(my_funds)
#Print lines one by one
signal_file = open("C:/Users/USERNAME/AppData/Roaming/MetaQuotes/Terminal/D190C39A3FEE6BA05C8C73D22E65170B/MQL4/Files/signals.txt","r")
for line in signal_file:
y = line
print(y)
signal_file.close()
However, it is not working. Please help.