FlatTrade Account
If you want to open account with Flattrade kinndly use this link https://openaccount.flattrade.in/O_FT038256
Donate
If you like my codes, consider for a donation. UPI details given in right side tab and in my telegram channel
Instructions
Batch file for Intallation and Live Updates/instructions will be given in the telegram channel EasySimpleTradeUpdates
Join falttrae official telegram group @FlattradeAPISupport to get offical support
FlatTrade API
Get API from from Flattrade . Watch this video . Only for API . For Login and Orders new AFL available.
Ram Disk Installation (Config manually), Python installation, creating folders, downloading AFLs, python script , csv files, format files, Creating Database all can do by batch script. check my telegram channel pinned message.
RAM Disk (batch script available for install only)
Install RAM Disk from here . Watch this video for installation instructions.
Open ram configuration , from start menu and set these settings.Keep Drive letter as R. File system FAT32. Size 64MB.
Python (batch script available)
Install official python 3.13.2 or 3.13.3 version from here . Watch this video for installation instructions . Jupyter notebook not required. Update PIP.
Default Folders (batch script available)
We use three folders. Create a Folder in C Drive as 'API' and 'HistoricalData'. Then keep drive letter as 'R'. In codes , these are default path to be used. if you want different paths change them in codes. Put all .csv files .py scripts in API folder. Ram Disk R is for to save response file. HistoricalData folder is for long period data download.
Downloads (batch script available)
All codes download here. Download Flattrade Login 1.py and Flattrade Limits 1.py and Put these two scripts in API folder (C:\API) . Download Flattrade Dasboard.afl and put in custom folder. Download format file OneMinuteFeed.format . Put the files in Format folder in Amibroker installation folder. For 32bit it is C:\Program Files (x86)\AmiBroker\Formats. OneMinuteFeed is for live feed. Download FlatTrade OneMinuteFeed.py and FlatTrade Backfill.py and put in C:\API folder
Database (batch script available)
Create new database with base time interval 1 minute. Make it default database (it enable while creating database). I keep PC Date format as DD-MM-YYYY. if anything goes wrong check this.
Amibroker configuration
Usernum
Usernum given as in parameter. it is for multiple users. for single user , use the default. Also the same number used in variables and scripts.
Login
from C:\API folder, open Flattrade Login 1.py file in IDE or in notepad.
Change your credentials with in the quotes. Change User ID, Password, TOTP Key, API Ket and API Secret . In the login_file drive letter R is the RAM disk drive letter. check this you are also using the same. It can run by from IDLE run module or double click to Execute. In Limits file no need to change anything. Limits file can run from Amibroker only.
Apply Flattrade Dasboard.afl on chart. You can apply on background sheet also like Sheet 2, Sheet 8 etc.
Check Parameter C:\API\ Driver letter and Folder Name are same as yours. Click Login. It execute login script and if login success execute limits script and Show the User ID and Cash Balance. StartFeed is to start feed. to stop feed just close the CMD window. Backfill files are download to RAM disk , so if you increase , decrease Number of downloads. 0 is for current day. it is for live market back fill, that time you can increase Number of Parallel Downloads to 20. For longer duration with from to date, use ScripMaster.afl . If you already use Order Place, You ca use this login also. Also check order place properly before market open. Login not work in morning between 5 to 7. Today login/token work upto tomorrow 5AM. If login in one pc, you can use the login response file in any PC and use, but don't use websocket in multiple PCs.
OneMinuteFeed (*.*)|*.*|OneMinuteFeed.format
and save it. it is for manual importing data files from Amibroker Import ASCII.
For Backfill and Live we need to create a token list as ScripMaster.csv . You can use ScripMaster afl. We give input as *List.csv are input files. replace your required symbols and put this files in API Folder. by clicking respective button in ScripMaster afl, it create *Master.csv file with token. Then click Join files, it merge all files *Master.csv in API folder and create ScripMaster.csv
Now you can backfill , Historical Data and Live Feed. Backfill is for recent days, for this we can give as number of days. To backfill current day give 0. Historical Data can download data by giving date range. it have option to import and delete in parameter.
Backfill or live feed data go to opened database. So, if other data feed open, if live feed script running or strat backfill script, it will get filled.
if you click Start Feed and it come like this, it is ok, tomorrow you are ready for live feed. to stop datafeed, just close the cmd window.
This is initial version only. More Features and other brokers will come.