Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/konstantinzolotarev/cryptopia_api
Cryptopia Exchange API client
https://github.com/konstantinzolotarev/cryptopia_api
cryptopia cryptopia-api elixir
Last synced: about 1 month ago
JSON representation
Cryptopia Exchange API client
- Host: GitHub
- URL: https://github.com/konstantinzolotarev/cryptopia_api
- Owner: konstantinzolotarev
- License: mit
- Created: 2017-08-26T17:45:22.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-01-22T11:27:27.000Z (almost 7 years ago)
- Last Synced: 2024-10-19T20:55:12.351Z (2 months ago)
- Topics: cryptopia, cryptopia-api, elixir
- Language: Elixir
- Homepage:
- Size: 21.5 KB
- Stars: 3
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CryptopiaApi [![Hex pm](http://img.shields.io/hexpm/v/cryptopia_api.svg?style=flat)](https://hex.pm/packages/cryptopia_api) [![hex.pm downloads](https://img.shields.io/hexpm/dt/cryptopia_api.svg?style=flat)](https://hex.pm/packages/cryptopia_api)
Cryptopia Crypto currency exchange API.
[Public API](https://www.cryptopia.co.nz/Forum/Thread/255)
[Private API](https://www.cryptopia.co.nz/Forum/Thread/256)
List of methods for module in [documentation](https://hexdocs.pm/cryptopia_api/api-reference.html)
## Installation
First add `cryptopia_api` to your `mix.exs` dependencies:
```elixir
def deps do
[
{:cryptopia_api, "~> 0.1.0"}
]
end
```and run `$ mix deps.get`. Then add `:cryptopia_api` to your applications list.
```elixir
def application do
[applications: [:cryptopia_api]]
end
```## Configuration
For Pulic API only no configuration is required.
But for Private API you have to configure application:
Add this lines to you application `config.exs`:
```elixir
use Mix.Configconfig :cryptopia_api, api_key: "you-api-key-here"
config :cryptopia_api, secret_key: "your-secret-key-here"
```## Timeout option
Library supports special `:request_timeout` option.
It iwll set defaul timeout for reply from cryptopia api.
By default it set to **8 seconds**You could change it using your application `config.exs`:
```elixir
use Mix.Configconfig :cryptopia_api, request_timeout: 10_000
```this option will be applied to all requests
## Usage
```elixir
iex(1)> CryptopiaApi.Public.get_market("ACC_BTC")
{:ok,
%{AskPrice: 4.263e-5, BaseVolume: 0.68372883, BidPrice: 4.021e-5,
BuyBaseVolume: 1.26308814, BuyVolume: 941758.73640983, Change: 35.97,
Close: 4.007e-5, High: 4.809e-5, Label: "ACC/BTC", LastPrice: 4.007e-5,
Low: 2.402e-5, Open: 2.947e-5, SellBaseVolume: 41.79914411,
SellVolume: 67079.729386, TradePairId: 5331, Volume: 20217.2373583}}iex(2)> CryptopiaApi.Public.get_market("ACC_BTC", 24)
{:ok,
%{AskPrice: 4.263e-5, BaseVolume: 0.68367683, BidPrice: 4.022e-5,
BuyBaseVolume: 1.28937411, BuyVolume: 942412.29131635, Change: 52.36,
Close: 4.007e-5, High: 4.809e-5, Label: "ACC/BTC", LastPrice: 4.007e-5,
Low: 2.402e-5, Open: 2.63e-5, SellBaseVolume: 41.79914411,
SellVolume: 67079.729386, TradePairId: 5331, Volume: 20215.47258623}}
```## License
Copyright © 2017 Konstantin Zolotarev
This work is free. You can redistribute it and/or modify it under the
terms of the MIT License. See the LICENSE file for more details.