Skip to main content

cira-classic

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

you shuld use cira and not cira-classic, cira-classic is for legacy users

a cira

GitHub stars Tweet

GitHub PyPI PyPI - Python Version PyPI - downloads

I was interested in using the Alpaca trade API for building a quantitative paper trader. The project is available here.
However after working on this for alomst a year (off and on) I realized that I had alomst build a small library for using the Alpaca API. So I thought that I would make this into a real library so that you can get started with quantitative paper trading as well.

The name cira is the word for a baby alpaca and because this is a simple and small lib I thought it would be a perfect fit.

Getting Started

Installation

You can install it using pip.

pip install cira-classic

Usage

Since the Alpaca trade API need a key, you need to generate your own and keep it in a JSON file which cira needs the path to. You can also set the variables directly or use an environment variable. However, it is recommended that you store it in 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_classic as cira
cira.KEY_FILE = "../mypath/key.json"
cira.buy(1, "TSLA")
print(cira.get_postion())
cira.sell(1, "TSLA")

Wiki and docs

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

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

Versioning & News

Cira-classic is the older structure of cira

If you find bug plz let me know with a issue. If you know how to solve the problem then you can of course make a pull request and I will take a look at it.

Development

To install cira with all the dev req.

git clone git@github.com:AxelGard/cira-classic.git
cd cira-classic/
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 in a very functional programming style. I'm also trying to follow the pep8 standard notation.

License

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

Acknowledgments

Release files for cira-classic 1.0.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for cira-classic 1.0.4
File Size Uploaded
cira-classic-1.0.4.tar.gz 6.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for cira-classic 1.0.4
File Interpreter ABI Platform
cira_classic-1.0.4-py3-none-any.whl Python 3 none any Details

Total release size: 12.3 kB

Release files / cira-classic-1.0.4.tar.gz

Download URL cira-classic-1.0.4.tar.gz
Size 6.0 kB
Tags Source
SHA-256 checksum
How to use checksums
092ad734f804fb26f83ce9922a079a36fc74899906dd0443462655c086136e6a
BLAKE2b-256 checksum
How to use checksums
68231eb47d5a7eeac018a987779ebe06373437b6fbb9297627b2fb8f820b1389
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

Release files / cira_classic-1.0.4-py3-none-any.whl

Download URL cira_classic-1.0.4-py3-none-any.whl
Size 6.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
40a5bf592de847f9eccfa11b05be15c1cd9a48ca260371aba255efcc0d569db5
BLAKE2b-256 checksum
How to use checksums
daa0b65dce438cadcf08ea9c3bd42b8df70444cfec9d473ec579886ee97d3dc4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.7.1 importlib_metadata/4.8.2 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.6.15

Release history Release notifications | RSS feed

This release

1.0.4 This release

2 release files

1.0.3

2 release files

1.0.2

2 release files

1.0.1

2 release files

1.0.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page