# -*- coding: utf-8 -*-
from setuptools import setup

package_dir = \
{'': 'src'}

packages = \
['buycoins', 'buycoins.modules']

package_data = \
{'': ['*']}

install_requires = \
['gql>=2.0.0,<3.0.0']

setup_kwargs = {
    'name': 'buycoins',
    'version': '1.0.2',
    'description': 'A Python SDK for the buycoins API',
    'long_description': "# Buycoins Python Library\n\n[![Build Status](https://travis-ci.com/edgeee/buycoins-python.svg?token=oQSNV8eQ1aycrRUjPbyg&branch=main)](https://travis-ci.com/edgeee/buycoins-python) [![Circle CI](https://img.shields.io/badge/license-MIT-blue.svg)](https://img.shields.io/badge/license-MIT-blue.svg) [![PyPI version](https://badge.fury.io/py/buycoins.svg)](https://badge.fury.io/py/buycoins) [![Python 3.6+](https://img.shields.io/badge/python-3.6-blue.svg)](https://www.python.org/downloads/release/python-360/)\n\nThis library provides easy access to the Buycoins API using the Python programming language. It provides all the feature of the API so that you don't need to interact with the API directly. This library can be used with Python 3.6+\n\n## Table of Contents\n* [Links](#links)\n* [Installation](#installation)\n* [Introduction](#introduction)\n  * [Primer](#primer)\n  * [Initialization](#initialization)   \n* [Accounts](#accounts)\n  * [Create Naira deposit account](#create-naira-deposit-account)\n* [Orders](#orders)\n  * [Get cryptocurrency prices](#get-cryptocurrency-prices)\n  * [Get price for single cryptocurrency](#get-single-cryptocurrency-price)\n  * [Buy a cryptocurrency](#buy-a-cryptocurrency)\n  * [Sell a cryptocurrency](#sell-a-cryptocurrency)\n* [P2P Trading](#p2p-trading)\n  * [Place limit orders](#place-limit-orders)\n  * [Place market order](#place-market-orders)\n  * [Get list of orders](#get-list-of-orders)\n  * [Get market book](#get-market-book)\n* [Transactions](#transactions)\n  * [Get cryptocurrency balances](#get-balances)\n  * [Get single balance](#get-single-balance)\n  * [Estimate network fee](#estimate-network-fee)  \n  * [Create wallet address](#create-wallet-address)\n  * [Send cryptocurrency](#send-cryptocurrency-to-an-address)\n* [Webhooks](#webhooks)\n  * [Verify event payload](#verify-event-payload)\n* [Contributing](#contributing)\n* [License](#license)\n    \n    \n\n## Links\n- Buycoins API documentation: https://developers.buycoins.africa/\n\n## Installation\nYou can install this package using pip:\n```sh\npip install --upgrade buycoins\n```\n\n## Introduction\n\n#### Primer\n- The library is structured around the concept of a `type`, so everything is a type. \n- All date quantities are specified as timestamps. So you would have to reconstruct the ISO dates yourself if you ever need to. \n- All cryptocurrency (and monetary) values are specified as decimals.\n- Supports all cryptocurrencies supported by Buycoins\n\n#### Initialization\nFirstly, request API access by sending an email to  [support@buycoins.africa](mailto:support@buycoins.africa) with the email address you used in creating a Buycoins account.\nWhen you've been granted access, you should be able to generate a public and secret key from the 'API settings' section of your account.\n\nYou have to initialize the library once in your app. You can do this when initializing databases, logging, etc.\nAs a security practice, it is best not to hardcode your API keys. You should store them in environmental variables or a remote Secrets Manager.\n\n```python\nimport buycoins\n\nbuycoins.initialize('<PUBLIC-KEY>', '<SECRET-KEY>')\n```\n\n### Accounts\nAccounts provide a way to programmatically create virtual naira accounts.\n\n#### Types\n```dtd\nVirtualDepositAccountType:\n    account_number: str\n    account_name: str\n    account_type: str\n    bank_name: str\n    account_reference: str\n```\n\n#### Create Naira deposit account\n```python\nimport buycoins as bc\n\nacc = bc.accounts.create_deposit('john doe')  # VirtualDepositAccountType\n\nprint(acc.account_name)  # john doe\nprint(acc.bank_name)  # bank name\nprint(acc.account_number)  # account number\nprint(acc.account_reference) # account reference\nprint(acc.account_type) # account type\n```\n\n### Orders\nOrders provide a way to buy from and sell directly to Buycoins.\nWhen buying or selling, price ID should be the ID gotten from calling either `.get_price()` or `.get_prices()`.\nMake sure to use price that hasn't expired yet, so call `.get_price(cryptocurrency)` to get the latest price for the cryptocurrency just before buying or selling.\n\n\n#### Types\n```dtd\nCoinPriceType:\n    id: str\n    cryptocurrency: str\n    buy_price_per_coin: Decimal\n    min_buy: Decimal\n    max_buy: Decimal\n    expires_at: int\n\nclass OrderType(NamedTuple):\n    id: str\n    cryptocurrency: str\n    status: str\n    side: str\n    created_at: int\n    total_coin_amount: str\n    static_price: Decimal\n    price_type: str\n    dynamic_exchange_rate: str\n    coin_amount: Decimal\n```\n\n#### Get cryptocurrency prices\n```python\nimport buycoins as bc\n\n# Get prices of all cryptocurrencies\nprices = bc.orders.get_prices()  # CoinPriceType[]\n\nprint(prices[0].id)  # ID of first price entry\nprint(prices[0].cryptocurrency)  # cryptocurrency\nprint(prices[0].expires_at)  # when this price entry will expire\nprint(prices[0].buy_price_per_coin)  # coin price\nprint(prices[0].min_buy)  # minimum amount you can buy\nprint(prices[0].max_buy)  # max amount you can buy\n```\n\n#### Get single cryptocurrency price\n```python\nimport buycoins as bc\n\nprice = bc.orders.get_price('bitcoin')  # CoinPriceType\n\nprint(price.id)  # ID of price entry\nprint(price.cryptocurrency)  # cryptocurrency\nprint(price.expires_at)  # when this price entry will expire\nprint(price.buy_price_per_coin)  # coin price\nprint(price.min_buy)  # minimum amount you can buy\nprint(price.max_buy)  # max amount you can buy\n```\n\n#### Buy a cryptocurrency\n```python\nimport buycoins as bc\n\n\norder = bc.orders.buy(\n    price_id='price-id',\n    coin_amount=1.52,\n    cryptocurrency='litecoin'\n)  # OrderType\n\nprint(order.id)  # Order ID\nprint(order.status)  # either active or inactive\nprint(order.side)  # buy\nprint(order.cryptocurrency)  # litecoin\nprint(order.total_coin_amount)  # Total coin amount\nprint(order.price_type)  # Price type\n```\n\n#### Sell a cryptocurrency\n```python\nimport buycoins as bc\n\n\norder = bc.orders.sell(\n    price_id='price-id',\n    coin_amount=0.0043,\n    cryptocurrency='ethereum'\n)  # OrderType\n\nprint(order.id)  # Order ID\nprint(order.status)  # either active or inactive\nprint(order.side)  # sell\nprint(order.cryptocurrency)  # litecoin\nprint(order.total_coin_amount)  # Total coin amount\nprint(order.price_type)  # Price type\n```\n\n\n### P2P Trading\nP2P Trading lets you trade cryptocurrencies with other users.\nIf you are not familiar with p2p trading on the Buycoins platform, read about it [here](https://developers.buycoins.africa/p2p/introduction)\n\n#### Types\n```dtd\nclass OrderType(NamedTuple):\n    id: str\n    cryptocurrency: str\n    status: str\n    side: str\n    created_at: int\n    total_coin_amount: str\n    static_price: Decimal\n    price_type: str\n    dynamic_exchange_rate: str\n    coin_amount: Decimal\n```\n\n### Place limit orders\nWhen placing limit orders, if `price_type` is `static`, `static_price` must also be specified, and if `price_type` is `dynamic`, `dynamic_exchange_rate` must be provided.\n\n```python\nimport buycoins as bc\n\n\norder = bc.p2p.place_limit_order(\n    side='buy', # either 'buy' or 'sell'\n    coin_amount=0.00043,\n    cryptocurrency='ethereum',\n    price_type='static',\n    static_price=0.004,\n    dynamic_exchange_rate=None  # float   \n)  # OrderType\n\nprint(order.id)  # Order ID\nprint(order.status)  # status, either active or inactive\nprint(order.cryptocurrency)  # bitcoin, litecoin, etc\nprint(order.coin_amount)  # coin amount\n```\n\n#### Place market orders\n```python\nimport buycoins as bc\n\n\n# Place market order\n# `order` has all the properties as shown above\norder = bc.p2p.place_market_order(\n    side='buy',  # either buy or sell\n    coin_amount=0.00023,\n    cryptocurrency='litecoin'\n)  # order is an OrderType\n\nprint(order.id)  # Order ID\nprint(order.status)  # status, either active or inactive\nprint(order.cryptocurrency)  # bitcoin, litecoin, etc\nprint(order.coin_amount)  # coin amount\n```\n\n#### Get list of orders\n```python\nimport buycoins as bc\n\n\norders, dynamic_price_expiry = bc.p2p.get_orders('active')  # (OrderType[], timestamp)\n\nprint(dynamic_price_expiry)  # timestamp of when dynamic price expires\nprint(orders[0].id)  # ID of first order\nprint(orders[1].status)  # status of the first order\n```\n\n\n#### Get Market book\n```python\nimport buycoins as bc\n\n\nmarket_book, dynamic_price_expiry = bc.p2p.get_market_book()  # (OrderType[], timestamp)\n\nprint(dynamic_price_expiry)  # timestamp of when dynamic price expires\nprint(market_book[0].id)  # ID of first order\nprint(market_book[1].status)  # status of the first order\n```\n\n\n### Transactions\n\nTransactions enable you to send and receive cryptocurrencies.\n\n#### Types\n```dtd\nCoinBalanceType:\n    id: str\n    cryptocurrency: str\n    confirmed_balance: Decimal\n\nNetworkFeeType:\n    estimated_fee: Decimal\n    total: Decimal\n\nTransactionType:\n    hash: str\n    id: str\n\nSendReturnValueType:\n    id: str\n    address: str\n    cryptocurrency: str\n    amount: Decimal\n    fee: Decimal\n    status: str\n    transaction: TransactionType\n\nAddressType:\n    cryptocurrency: str\n    address: str\n```\n\n#### Get balances\n```python\nimport buycoins as bc\n\nbalances = bc.transactions.get_balances()  # CoinBalanceType[]\n\nprint(balances[0].cryptocurrency)  # bitcoin, litecoin, etc\nprint(balances[0].confirmed_balance)  # the confirmed balance\n```\n\n\n#### Get single balance\n```python\nimport buycoins as bc\n\n\nbalance = bc.transactions.get_balance('bitcoin')  # CoinBalanceType\n\nprint(balance.cryptocurrency)  # bitcoin\nprint(balance.confirmed_balance)  # the confirmed balance\n```\n\n#### Estimate network fee\n```python\nimport buycoins as bc\n\n\nfee = bc.transactions.estimate_network_fee(\n    'bitcoin',  # cryptocurrency\n    0.32,  # txn amount\n)  # NetworkFeeType\n\nprint(fee.estimated_fee)  # estimated fee for txn\nprint(fee.total)   # total\n```\n\n#### Send cryptocurrency to an address\n```python\nimport buycoins as bc\n\n\nsent = bc.transactions.send(\n    cryptocurrency='ethereum',\n    amount=0.0023,\n    address='<wallet-address>'\n)  # SendReturnValueType\n\nprint(sent.fee)  # fee charged for the 'send' txn\nprint(sent.status) # status of the txn\nprint(sent.transaction.id)  # ID of the txn\nprint(sent.transaction.hash)  # txn hash\n```\n\n#### Create wallet address\n```python\nimport buycoins as bc\n\n\naddr = bc.transactions.create_address('bitcoin')  # AddressType\n\nprint(addr.address)  # Address string\nprint(addr.cryptocurrency)  # cryptocurrency\n```\n\n\n### Webhooks\n\nWebhooks provides a way for Buycoins to inform you of events that take place on your account.\nSee the [Buycoins documentation](https://developers.buycoins.africa/webhooks/introduction) for  an introduction and the available events.\n\n#### Verify event payload\nEnsure that the webhook event originated from Buycoins\n\n```python\nimport buycoins as bc\n\n\nis_valid = bc.webhook.verify_payload(\n    body='<raw request body from buycoins (in bytes)>',\n    webhook_token='<webhook-token generated on buycoins>',\n    header_signature='X-Webhook-Signature header'\n)\n\nprint(is_valid)  # True if the event is from Buycoins, False otherwise.\n```\n\n## Testing\nTo run tests:\n\n```shell\npoetry run pytest\n```\n\n\n## Contributing\nSee [CONTRIBUTING.md](CONTRIBUTING.md)\n\n\n## License\n[MIT License](https://github.com/edgeee/buycoins-python/blob/master/LICENSE)\n",
    'author': 'Rasheed Musa',
    'author_email': 'rasheedmusa9@gmail.com',
    'maintainer': None,
    'maintainer_email': None,
    'url': 'https://github.com/edgeee/buycoins-python',
    'package_dir': package_dir,
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.6,<3.7',
}


setup(**setup_kwargs)
