-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
33 additions
and
235 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,277 +1,75 @@ | ||
# Firi API wrapper | ||
# FiriAPI | ||
|
||
[![Upload Python Package](https://github.com/jeircul/firipy/actions/workflows/publish.yml/badge.svg)](https://github.com/jeircul/firipy/actions/workflows/publish.yml) | ||
[![Run Tests](https://github.com/jeircul/firipy/actions/workflows/run_tests.yml/badge.svg)](https://github.com/jeircul/firipy/actions/workflows/run_tests.yml) | ||
![PyPI - Version](https://img.shields.io/pypi/v/firipy) | ||
![GitHub](https://img.shields.io/github/license/jeircul/firipy) | ||
FiriAPI is a Python client for the Firi API. | ||
|
||
Python3 wrapper around the [Firi Trading API (1.0.0)](https://developers.firi.com/)<b></b> | ||
> I have **no** affiliation with Firi, use at your **own** risk. | ||
## Installation | ||
|
||
## 📦 Installation | ||
PyPI | ||
```pip | ||
pip install -U firipy | ||
``` | ||
|
||
## 🚀 Usage | ||
|
||
**API Key** from [Firi](https://platform.firi.com/) is required: | ||
```python | ||
from firipy import FiriAPI | ||
|
||
fp = FiriAPI(token='YOUR_API_KEY') | ||
print(fp.balances()) | ||
``` | ||
|
||
## 🔌 Endpoints included | ||
|
||
> :book: [Firi Trading API (1.0.0)](https://developers.firi.com/) for more details | ||
|
||
* **/time** | ||
|
||
```python | ||
# Get current timestamp in epoch | ||
fp.time() | ||
``` | ||
|
||
* **/v2/history/transactions?count=100000000000000000000** | ||
|
||
```python | ||
fp.history_transactions() | ||
``` | ||
|
||
* **/v2/history/transactions/{year}** | ||
|
||
```python | ||
fp.history_transactions_year(year) | ||
``` | ||
|
||
* **/v2/history/transactions/{month}/{year}** | ||
|
||
```python | ||
fp.history_transactions_month_year(month, year) | ||
``` | ||
|
||
* **/v2/history/trades** | ||
|
||
```python | ||
fp.history_trades() | ||
``` | ||
|
||
* **/v2/history/trades/{year}** | ||
|
||
```python | ||
fp.history_trades_year(year) | ||
``` | ||
|
||
* **/v2/history/trades/{month}/{year}** | ||
|
||
```python | ||
fp.history_trades_month_year(month, year) | ||
``` | ||
|
||
* **/v2/history/orders** | ||
|
||
```python | ||
fp.history_orders() | ||
``` | ||
|
||
* **/v2/history/orders/{market}** | ||
|
||
```python | ||
fp.history_orders_market(market) | ||
``` | ||
|
||
* **/v2/markets/{market}/history** | ||
|
||
```python | ||
fp.markets_market_history(market) | ||
``` | ||
|
||
* **/v2/markets/{market}/depth** | ||
|
||
```python | ||
fp.markets_market_depth(market) | ||
``` | ||
|
||
* **/v2/markets/{market}** | ||
|
||
```python | ||
fp.markets_market(market) | ||
``` | ||
|
||
* **/v2/markets** | ||
|
||
```python | ||
fp.markets() | ||
``` | ||
|
||
* **/v2/markets/{market}/ticker** | ||
|
||
```python | ||
fp.markets_market_ticker(market) | ||
``` | ||
|
||
* **/v2/markets/tickers** | ||
|
||
```python | ||
fp.markets_tickers() | ||
``` | ||
|
||
* **/v2/XRP/withdraw/pending** | ||
|
||
```python | ||
fp.xrp_withdraw_pending() | ||
``` | ||
|
||
* **/v2/XRP/address** | ||
|
||
```python | ||
fp.xrp_withdraw_address() | ||
``` | ||
|
||
* **/v2/LTC/withdraw/pending** | ||
|
||
```python | ||
fp.ltc_withdraw_pending() | ||
``` | ||
|
||
* **/v2/LTC/address** | ||
|
||
```python | ||
fp.ltc_withdraw_address() | ||
``` | ||
|
||
* **/v2/ETH/withdraw/pending** | ||
|
||
```python | ||
fp.eth_withdraw_pending() | ||
``` | ||
|
||
* **/v2/ETH/address** | ||
|
||
```python | ||
fp.eth_Address() | ||
``` | ||
|
||
* **/v2/DAI/withdraw/pending** | ||
|
||
```python | ||
fp.dai_withdraw_pending() | ||
``` | ||
|
||
* **/v2/DAI/address** | ||
|
||
```python | ||
fp.dai_Address() | ||
``` | ||
You can install FiriAPI using pip: | ||
|
||
* **/v2/DOT/address** | ||
|
||
```python | ||
fp.dot_Address() | ||
``` | ||
|
||
* **/v2/DOT/withdraw/pending** | ||
|
||
```python | ||
fp.dot_withdraw_pending() | ||
``` | ||
|
||
* **/v2/BTC/withdraw/pending** | ||
|
||
```python | ||
fp.btc_withdraw_pending() | ||
``` | ||
|
||
* **/v2/BTC/address** | ||
|
||
```python | ||
fp.btc_Address() | ||
``` | ||
|
||
* **/v2/ADA/withdraw/pending** | ||
|
||
```python | ||
fp.ada_withdraw_pending() | ||
```bash | ||
pip install firipy | ||
``` | ||
|
||
* **/v2/ADA/address** | ||
## Usage | ||
|
||
```python | ||
fp.ada_Address() | ||
``` | ||
|
||
* **/v2/deposit/history?count=1000000** | ||
First, import the `FiriAPI` class from the `firipy` module: | ||
|
||
```python | ||
fp.deposit_history() | ||
from firipy import FiriAPI | ||
``` | ||
|
||
* **/v2/deposit/address** | ||
Then, initialize the client with your API token: | ||
|
||
```python | ||
fp.deposit_address() | ||
client = FiriAPI("your-token") | ||
``` | ||
|
||
* **/v2/orders** | ||
Now you can use the client to interact with the Firi API. For example, to get the current time: | ||
|
||
```python | ||
fp.orders() | ||
time = client.time() | ||
print(time) | ||
``` | ||
|
||
* **/v2/orders/{market}** | ||
To get history over all transactions: | ||
|
||
```python | ||
fp.orders_market(market) | ||
history = client.history_transactions() | ||
print(history) | ||
``` | ||
|
||
* **/v2/orders/{market}/history** | ||
To create an order: | ||
|
||
```python | ||
fp.orders_market_history(market) | ||
order = client.post_orders("market", "type", "price", "amount") | ||
print(order) | ||
``` | ||
|
||
* **/v2/orders/history** | ||
To get balances: | ||
|
||
```python | ||
fp.orders_history() | ||
balances = client.balances() | ||
print(balances) | ||
``` | ||
|
||
* **/v2/order/{orderID}** | ||
## Rate Limiting | ||
|
||
```python | ||
fp.order_orderid(orderID) | ||
``` | ||
|
||
* **/v2/balances** | ||
FiriAPI includes a rate limit, which is the number of seconds to wait between requests. By default, this is set to 1 second. You can change this when you initialize the client: | ||
|
||
```python | ||
fp.balances() | ||
client = FiriAPI("your-token", rate_limit=2) # wait 2 seconds between requests | ||
``` | ||
|
||
* **/v2/orders** | ||
## Error Handling | ||
|
||
```python | ||
fp.delete_orders() | ||
``` | ||
|
||
* **/v2/orders/{orderID}/{market}/detailed** | ||
FiriAPI handles HTTP errors using the `requests.Response.raise_for_status` method. If a request fails, this method raises a `requests.HTTPError` exception. The client catches this exception and prints an error message. | ||
|
||
```python | ||
fp.delete_oders_orderid_market_detailed(orderID, market) | ||
``` | ||
The client also handles other exceptions that might occur during the execution of a request, and prints an error message in these cases. | ||
|
||
* **/v2/orders/{orderID}/detailed** | ||
## Contributing | ||
|
||
```python | ||
fp.delete_oders_orderid_detailed(orderID) | ||
``` | ||
Contributions to FiriAPI are welcome! Please submit a pull request or create an issue on the [GitHub page](https://github.com/jeircul/firipy). | ||
|
||
* **/v2/orders/{marketOrMarketID}** | ||
## Disclaimer | ||
|
||
```python | ||
fp.delete_orders_marketormarketsid(marketOrMarketID) | ||
``` | ||
This client was developed by Ove Aursland and is not officially associated with Firi. |