Dear All ,
My project is related to automating Zerodha kite connect API interface in python. current scope is to setup a kite connect API interface , a program to send a order with various combination (BO - future order for buy or sell)and tracking the order and update execution of full traction via email (eg. Buy order details / sell order details / total brokerage / total net profit etc. )
This is POC for trading Robot - Scope of the project(POC) is as follows
1. Automate the login process, system should redirect for manual login to get request_token – open a browser for login on the starting of the program.
2. Once user login and submit, program should extract request token, take the control and maintain the login for full day – request token should be kept in a separate log file for full day use , if log file doesn’t have request token , then system should go to step one again, and send the email to user.
3. Market should check for trading activity and sufficient volume on a day (volume count should be read from prop.xml file)
4. Program should send automated email update on successfully login session creation and monitor session every minute, if session expire, should also send automated email to user.
5. Once system is ready for trading post login – it should do following pre trade checks
a. Get the current months future contract name (script name)
b. Check for any existing (intraday) order exits for current months future (if yes – send email to user )
c. Check balance and calculate margin requirement for bracket future order (eg .profit trigger 20 unit and stop loss 10units & 3 lots – all these values should be read from property file – prop.xml) – send email to user if balance is below required margin
d. If margin is less, system should do the balance check for every 5 min –check should be starting for reading property file for number of contract and profit and loss trigger values – so user can bring down the parameters to match the margin requirement or add sufficient margin.
e. On successful completion of pre-check system should go to next step.
6. System should check the order execution time on 24 HH format in the prop.xml. for eg.
If time is 10:00 , system should initiate order at 10:00 hours as follow
a. Generate a 5 digit random number.
b. If number is even send a buy BO market order for current months future with the parameters configured in prop.xml (number of lots , profit trigger ,stop loss trigger etc. )
c. Check the order status every 5 second for execution, pending, rejection etc and update user on email only if executed or rejected.
d. If order executed, then check for square off order till the predefine time in prop.xml (for eg. 15:20). If order doesn’t square off till this time, system should square off the order at market rate.
e. Track the square off order and intimate user once its squared off.
7. After market hours (approx. 4 pm) , system should prepare a formal report of the day for both order (Original buy / sell order and square off order) , report should have following details
Order script, buy price, sell price, net profit in unit, time of buy, time of sell etc. system should email these details to user and self-terminate the session for the day.
system should be thoroughly tested and all exception should be catch and handled properly.
developer should document the system and do a first setup on user environment/ machine and provide setup document for future installation and setup.
Master configuration(refereed as prop.xml in SOW) file attached , this may be xml or excel format .