Package: gemini-api
Gemini API WrapperA Python wrapper for the cyrptocurrency exchange Gemini.Explore the docs »View Blog Post·Report Bug/Request FeatureTable of ContentsAbout The ProjectBuilt WithGetting StartedPrerequisitesInstallationUsageRoadmapContributingLicenseAbout The ProjectA Python wrapper for the cryptocurrency exchange Gemini that offer both public and private REST APIs. Within your Gemini account settings, visit the API section to generate API keys for Account level use (Master level keys not yet supported by this wrapper).When provisioning a session key, you have the option of marking the session as "Requires Heartbeat". When selected, if the exchange does not receive a message for 30 seconds,
then it will assume there has been an interruption in service and all outstanding orders on this session will be canceled. To maintain the session,
the you must send a heartbeat message (using the revive_heartbeat method in the 'order' endpoint) at a more frequent interval.Public REST APIs provide market data such as:current order bookrecent trading activitytrade historyPrivate REST APIs allow you to manage both orders and funds:place and cancel orderssee your active orderssee your trading history and trade volumeget your available balancesIn addition to the API key methods described in the private APIs, Gemini supports OAuth 2.0 flows and this is currently being developed for future implementation in this package.Gemini's Sandbox site is an instance of the Gemini Exchange that offers exchange functionality using test funds - the Sandbox site URL is chosen for the connection
at the instantiation of the authentication class for the private API invocation.To prevent abuse, Gemini imposes rate limits on incoming requests as described in the Gemini API Agreement.For public API entry points, Gemini limit requests to 120 requests per minute, and recommend that you do not exceed 1 request per second.For private API entry points, Gemini limit requests to 600 requests per minute, and recommend that you not exceed 5 requests per second.(back to top)Built WithPython 3.8.11PyenvPoetry(back to top)Getting StartedThe package is available on PyPI and can be installed using pip or poetry.InstallationYou'll need to have Python 3.6 or above. Package dependencies are listed in the poetry.lock file.Sign in to Gemini and get API Keyshttps://exchange.gemini.com/Note that this is for the real account - if you want to use the Sandbox Gemini account for testing, signup for a separate Sandbox account and create your keys therehttps://exchange.sandbox.gemini.com/Install packagepipinstallgemini_apiStack some sats programmatically 😎If you would like to edit the source code yourselfClone this repogitclonehttps://github.com/eliasbenaddou/gemini_apiInstall required dependenciespoetryinstall(back to top)Usage ExamplesHere is an example of creating a new order in the Sandbox test environment through the Order Placement API by instantiatng a new Authentication object with your public and private key and providing it to the Order class.The class method 'new_order' will return an Order object and the 'order_id' attribute for the new order created is printed.fromgemini_api.endpoints.orderimportOrderfromgemini_api.authenticationimportAuthenticationauth=Authentication(public_key="XXXXXXXXXX",private_key="XXXXXXXXXX",sandbox=True,)if__name__=="__main__":x=Order.new_order(auth=auth,symbol="btcusd",amount="1",price="20000",side="buy",options=["maker-or-cancel"],)print(x.order_id)For more examples, please refer to theDocumentation(back to top)RoadmapPublic APIsSymbol DetailsTickerTicker V2CandlesCurrent Order BookAuction HistoryPrice FeedOrder Placement APIsNew OrderCancel OrderWrap OrderCancel All Session OrdersCancel All Active OrdersOrder Status APIsOrder StatusGet Active OrdersGet Past OrdersFee and Volume APIsGet Notional VolumeGet Trade VolumeFX Rate APIFund Management APIsGet Available BalancesGet Notional BalancesCustody Account FeesGet Deposit AddressesNew Deposit AddressWithdraw Crypto FundsGas Fee EstimationInternal Transfers (Requires Master level key)Add BankAdd A Bank CADPayment MethodsSEN WithdrawalsApproved Addresses APIsAccount Administration APIsOAuth 2.0 AuthenticationWebsocket APIsGemini Clearing(back to top)ContributingContributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make aregreatly appreciated.If you have a suggestion that would make this better, please fork the repo and create a pull request. You can also simply open an issue with the tag "enhancement".Fork the ProjectCreate your Feature Branch (git checkout -b feature/AmazingFeature)Commit your Changes (git commit -m 'Add some AmazingFeature')Push to the Branch (git push origin feature/AmazingFeature)Open a Pull RequestDon't forget to give the project a star if you found it useful! Thanks!(back to top)LicenseDistributed under the MIT License. SeeLICENSE.txtfor more information.(back to top)DisclaimerThis package connects to a live crytpcurrency exchange and the user takes full responsibility when using it. I am not liable for any costs or errors due to incorrect code or unanticipated actions. Use the Sandbox environment first to get familiar with the code and check it performs the expected actions.If the user is not comfortable accepting the risks that come with using this program then they should not use it. It is licensed under an MIT license so you are free to dissect and use any part of this codebase as you wish.