Skip to content

konstantinzolotarev/cryptopia_api

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CryptopiaApi Hex pm hex.pm downloads

Cryptopia Crypto currency exchange API.

Public API

Private API

List of methods for module in documentation

Installation

First add cryptopia_api to your mix.exs dependencies:

def deps do
  [
    {:cryptopia_api, "~> 0.1.0"}
  ]
end

and run $ mix deps.get. Then add :cryptopia_api to your applications list.

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:

use Mix.Config

config :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:

use Mix.Config

config :cryptopia_api, request_timeout: 10_000

this option will be applied to all requests

Usage

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.

About

Cryptopia Exchange API client

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages