This client is a wrapper for the official Lupo API
Project description
Zorro Client
zorro-client
is a library written for use with Zorro, an algorithmic trading platform. This library includes a full API client with access to user-written indicators and strategies. In addition, it includes the backtesting framework and scripting language used by Zorro, so you can test out your strategies on your own data as well.
Install
$ pip3 install zorro-client
Example
import zorro
theAPI = zorro.Api(
api_key="your-api-key",
secret_key="your-secret-key")
my_indicator = theAPI.indicators['indicator-id']
my_strategy = theAPI.strategies['strategy-id']
stock_data = zorro.StockData.create(
["AAPL", "AMZN"],
"2020-01-03",
"2020-07-11",
"1d")
# backtest the strategy
backtest = my_strategy.create_backtest(stock_data)
backtest.simulate()
# find important details
backtest_results = backtest.analyze()
sharpe_ratio = backtest_results['sharpe_ratio']
alpha = backtest_results['alpha']
beta = backtest_results['beta']
profit_pct = backtest_results['profit_percent']
profit = backtest_results['profit']
trade_history = backtest.trade_history
print(backtest_results)
Usage
Import
import zorro
Create a strategy
my_strategy = zorro.Strategy(
{
"type": "order",
"stock": "AAPL",
"qty": "10"
}
)
Execute the strategy on a paper API
No setup required.
paper_broker = zorro.PaperBroker()
my_strategy.execute(handler=paper_broker)
Execute the strategy on a live API
To do this, you will need an Alpaca account. You can create one here.
live_broker = zorro.LiveBroker(
alpaca_api_key_id="<Your API key>",
alpaca_api_secret="<Your API secret")
my_strategy.execute(handler=live_broker)
Thank you for using Zorro!
If you have any questions, reach out to us at our email.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
No source distribution files available for this release.See tutorial on generating distribution archives.
Built Distribution
Close
Hashes for lupoclient-0.0.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 103f3c2e4e0823b403bd47f2578de15150d37fd8f832e76d979f9cc77f22f08e |
|
MD5 | 13d54597ca9044f4046fb4188f23c3b7 |
|
BLAKE2b-256 | d77ceb71d7a7dc38aed505d1365861e4f10e9fabfd99984ccc29d262ebe22293 |