Skip to main content

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


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

If you're not sure about the file name format, learn more about wheel file names.

lupoclient-0.0.1-py3-none-any.whl (8.7 kB view details)

Uploaded Python 3

File details

Details for the file lupoclient-0.0.1-py3-none-any.whl.

File metadata

  • Download URL: lupoclient-0.0.1-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

Hashes for lupoclient-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 103f3c2e4e0823b403bd47f2578de15150d37fd8f832e76d979f9cc77f22f08e
MD5 13d54597ca9044f4046fb4188f23c3b7
BLAKE2b-256 d77ceb71d7a7dc38aed505d1365861e4f10e9fabfd99984ccc29d262ebe22293

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page