This client is a wrapper for the official Zorro 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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file zorroclient-0.0.1a0-py3-none-any.whl.
File metadata
- Download URL: zorroclient-0.0.1a0-py3-none-any.whl
- Upload date:
- Size: 8.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.1.1 pkginfo/1.5.0.1 requests/2.23.0 setuptools/47.1.1 requests-toolbelt/0.9.1 tqdm/4.24.0 CPython/3.7.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
2ab6818358966a58ce1ad3138b32c26b97392bd3ec788126d33d437035a49c13
|
|
| MD5 |
134a664d8950847436d1b2b4aece4c14
|
|
| BLAKE2b-256 |
66604caa89a3fbf8b41f6aba5ae2d0352cd1fbdf07b8a10d24dc5c0baa33bdb4
|