Skip to main content

A older style of the cira library.

Project description

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!

a cira

GitHub stars Tweet

GitHub PyPI PyPI - Python Version

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

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-classic-1.0.3.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

cira_classic-1.0.3-py3-none-any.whl (6.3 kB view details)

Uploaded Python 3

File details

Details for the file cira-classic-1.0.3.tar.gz.

File metadata

  • Download URL: cira-classic-1.0.3.tar.gz
  • Upload date:
  • Size: 5.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for cira-classic-1.0.3.tar.gz
Algorithm Hash digest
SHA256 c16695c42d5057d361af5ec40dfedb5b4242676b30c1890ea21e38caa9450712
MD5 4415d2c59cd7e4bf43b45bfe8d5b20a2
BLAKE2b-256 88296fb7080f33811320cc509e50845c498ff3d34e013bf8953f63088602e9ad

See more details on using hashes here.

File details

Details for the file cira_classic-1.0.3-py3-none-any.whl.

File metadata

  • Download URL: cira_classic-1.0.3-py3-none-any.whl
  • Upload date:
  • Size: 6.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.3.0 pkginfo/1.6.1 requests/2.25.1 setuptools/40.6.2 requests-toolbelt/0.9.1 tqdm/4.55.1 CPython/3.6.12

File hashes

Hashes for cira_classic-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 d0456b6bc3cf3a519a75acd42c091d9163f2d37aeabc5907aee70da74e040a05
MD5 fdf5445be005769ed2287fed0b43ca00
BLAKE2b-256 65b290f08ed532a3ce05d26a207fcb2f5f83ce7d206cb8f3d70835fe004d58b9

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