Pyrobot
Table of Contents
Overview
Current Version: 1.0.6
A trading robot written in Python utilizing the Lemon Markets API designed to mimic a few common scenarios:
-
Providing an interface for the user's trading account. The PyRobot
object will initialize a new instance of the robot and provide general information regarding the user's account. It will also serve as main object connecting all other objects to provide easy access to other functionalities.
-
Maintaining a portfolio of multiple instruments. The Portfolio
object will be able
to calculate common portfolio risk metrics, display order information, and provide both historical and real-time prices for instruments.
-
Define an order that can be used to trade a financial instrument. With the Trade
object, you can place, cancel and retrieve orders.
-
Define and calculate indicators using both historical and real-time prices. The Indicator
object
will help you easily define the input of your indicators, calculate them, and then update their values
as new prices come.
-
Access new information daily. The MarketData
,TradingPositions
and TradingAccount
objects will interact with the Lemon Markets API to ensure the trader is equipped with up-to-date information regarding the market and their portfolio.
Setup
Setup - PyPi Install:
The project can be found at PyPI, if you'd like to view the project please use this
link. To install the library,
run the following command from the terminal.
pip install trad-robo-python
Usage
To run the robot, you will need to provide a few pieces of information from your Lemon Markets Paper Trading Account
The following items are need for authentication:
-
Market Data API Key: This will be provided when you register an account with the Lemon Markets website. An example of a Market Data API key could look like the following eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJh
.
-
Paper Trading API Key: This will be provided when you register an account with the Lemon Markets website. An example of a Paper Trading API key could look like the following eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.
.
Once you've identified those pieces of info, you can run the robot. Here is a simple example that will create a new instance
of it:
from pyrobot.robot import PyRobot
trading_robot = PyRobot(
market_api_key='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJh',
paper-trading_api_key='eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.'
)
For more detailed examples, go to the run_robot.py
file to see an example of how to use the library along with all the different objects inside.