Package: cira
ciraCira algorithmic trading made easy. AFaçade libraryfor simpler interaction with alpaca-trade-API from Alpaca Markets.Cira is available onpip.Please give it a star if you like it!The namecirais a miss spelling of the word for ababy alpaca criaand because this is a simple and small lib I thought it would be a perfect fit.Axel Gardis main developer for cira.A new version v3.0.0 is comming, it will have breaking changes!Im working the new version with moremachine learning supportand moving the underlying SDK toAlpaca-py.
If you want to take a look,here is the branchbut this is still under quite have development.
It will have some breaking changes, sorry for that.
I will change some of the interfaces to make it more clear when things are happening.Getting StartedYou can get started fast by using thecira-group boilerplate.
If you are new to cira checkout thetutorial.InstallationYou can install it usingpip.pipinstallciraUsageSince the Alpaca trade API need a API key, you need to generate your own key atalpaca markets website. If you want to play around with it you can try paper trading (recommended for beginners). I recommend keep it in aJSON filewhich cira needs thepathto.
You can also set the variables directly or use an environment variable, see thewikifor diffrent the ways. However, it is recommended that you store it in a file just make sure not to upload that file on any public repositories.key.json{"APCA-API-KEY-ID":"your_pub_key","APCA-API-SECRET-KEY":"your_private_key"}then you can start using the libimportciracira.alpaca.KEY_FILE="../mypath/key.json"stock=cira.Stock("TSLA")stock.buy(1)stock.sell(1)New classes with cira v.2!portfolio=cira.Portfolio()# methods for your portfolioexchange=cira.Exchange()# methods for exchangestock=cira.Stock("TSLA")# a class for one stockA simple algorithmIn just a couple of lines you are up and running, with a super simple algorithm.importciraimportrandomimporttimecira.alpaca.KEY_FILE="../mypath/key.json"portfolio=cira.Portfolio()exchange=cira.Exchange()qty=1# choose how many stocks should be handled in one sessionwhileTrue:whileexchange.is_open:forstockinrandom.choices(exchange.stocks,k=qty):stock.buy(1)forstockinrandom.choices(portfolio.owned_stocks,k=qty):stock.sell(1)time.sleep(60*30)# 30 min timeryou can find more examples on thewiki/examplesand thewiki/tutorialfor even more information.Things to checkoutNewsWikiTutorialStoring the Alpaca API keyExamples of how to use ciraDiscussionsCira-groupWikiand docsTo see what more you can do check out thewiki.I also have an example of how to build aindex fund trader with cira.Want the old version?For backwards compatibility I made sure to fork cira in tocira-classicand cira-classic is also available onpypi with pip.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.Have a question?If you have a question about cira, want to share what you built with cira or want to talk to others using cira,
you can checkout thediscussions pageor make issue if that is more fitting.History of ciraI was interested in using the Alpaca trade API for building a quantitative paper trader.
The project is availablehere.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.DevelopmentIf you want to help develop cira you are more then welcome to do so.
Feel free to make a pull request or issue.
To install cira with all the dev req.gitclonegit@github.com:AxelGard/cira.gitcdcira/
gitcheckoutdevelopand know you need topython3-mvenvenvsourceenv/bin/activate
pipinstall-e.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.touchtests/test_key.json
pytestCoding styleI'm trying to follow thepep8standard notation.
I try to make the library to be so intuitive as possible for easy of use.LicenseThis project is licensed under the MIT License - see theLICENSEfile for detailsAcknowledgmentsAlpaca APIpaper-tradercira-classic