Skip to main content

A simpler library for the alapaca trade api

Project description

cira

A simpler libray for alpaca-trade-api from Alpaca Markets. Cira is available pip. Plz give it a star if you like it!

a cira

GitHub stars Tweet

GitHub PyPI PyPI - Python Version

I was intrested in using the alpaca trade api for building quantitative paper trading. The project paper-trader.
However after working on this for alomst a year (of and ond agian) I relized that I had alomst build a small libray for using the alpca api. So I thought that shuld make this in to a real lib so that you also can get started with quantitative paper trading.

The name Cira is the word for a baby alpca and becose this is a simpel and small lib I thoght it would be a prefect fit.

Getting Started

Installation

You can install by pip.

pip install cira

Usage

Becose the alpca trade API need a key. You need to keep your api key in a json file. Cira needs the path to the file. You can also set the variables directly or a environment variable. But you should use a file.
key.json

{
  "APCA-API-KEY-ID":"your_pub_key",
  "APCA-API-SECRET-KEY":"your_private_key"
}

then you can start using the lib

import cira
cira.KEY_FILE = "../mypath/key.json"
cira.buy(1, "TSLA")
print(cira.get_postion())
cira.sell(1, "TSLA")

Wiki and doc's

To se more you can what you can do check out the wiki.

I also have an exampel of how to build a index fund with Cira or check out paper-trader for my usage of cira.

Versioning & News

cira still has some things that need be implemented in order to be enter a v0.1.0, for exampel thigs like short;ing stocks and adding support for more stock markets then NASDAQ.

if you find bug plz let me know with a issue or if you think you know what the problem is you can ofcourse make a pull request an I will take a look at it.

Development

To install cira with all the dev req.

git clone git@github.com:AxelGard/cira.git
cd cira/
git checkout develop

and know you need to

python3 -m venv env
source env/bin/activate
pip install -e .[dev]

Run tests using pytest. Ensure that you are in the cira dir. But you will need a new key. This key should not only be used for testing or if you don't mind if all of the assets in the portfolio being sold.

touch tests/test_key.json
pytest

Coding style

I have been building this i a vary functional programming style. I'm also trying to follow the pep8 std notation.

License

This project is licensed under the MIT License - see the LICENSE file for details

Acknowledgments

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

cira-1.0.0.tar.gz (5.8 kB view hashes)

Uploaded Source

Built Distribution

cira-1.0.0-py3-none-any.whl (6.1 kB view hashes)

Uploaded Python 3

Supported by

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