Code Monkey home page Code Monkey logo

pybtcturk's Introduction

pybtcturk

Python client for the Btcturk Api.

Build version License Python version

Installation

pip install btcturk
pip install git+git://github.com/erhan/pybtcturk.git

Usage

Btcturk Pair symbols

  • BTCTRY
  • ETHTRY
  • XRPTRY

Public Endpoint Methods

from btcturk import Btcturk  

client = Btcturk()  

Ticker

client.ticker()  

Get order book

client.get_order_book(pair_symbol)

Get all trades

client.get_all_trades(pair_symbol)

Get last trades

client.get_last_trades(pair_symbol, count)

Get all ohlc data

client.get_all_ohlc(pair_symbol)

Get daily ohlc data

client.get_daily_ohlc(pair_symbol, days)

Private Endpoint Methods

from btcturk import Btcturk  

client = Btcturk("public_key", "private_key")

Get balances

client.get_balances()
# example return : 
client.get_balances_v2()
# example return : 

Get transactions

client.get_transactions(limit, offset, ascending)

Get open orders

client.get_open_orders(pair_symbol)

Cancel order

client.cancel_order(order_id)

Market buy

client.market_buy(pair_symbol, total, total_precision)

Market sell

client.market_sell(pair_symbol, amount, amount_precision)

Limit buy

client.limit_buy(pair_symbol, amount, amount_precision, price, price_precision)

Limit sell

client.limit_sell(pair_symbol, amount, amount_precision, price, price_precision)

Stop buy

client.stop_buy(pair_symbol, total, total_precision, trigger_price, trigger_price_precision)

Stop sell

client.stop_sell(pair_symbol, total, total_precision, trigger_price, trigger_price_precision)

pybtcturk's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

pybtcturk's Issues

get_open_orders method generate errors

Hi;
When I try to use og

sniplet:
from btcturk import Btcturk

Public MBTCods

client = Btcturk()

Private MBTCods

client = Btcturk("yyyyyyyyyyyy6-4824-a36a-xxxxxxxxxx", "yWVvDiZJxxxxxxxxxxxxxaaaaaaa")
print(client.get_open_orders("BTCTRY"))

error:

Traceback (most recent call last):
File "paribu_read.py", line 17, in
print(client.get_open_orders("BTCTRY"))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/btcturk/btcturk.py", line 154, in get_open_orders
return self._make_request(method="GET", path="openOrders", params=params)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/btcturk/btcturk.py", line 40, in _make_request
return resp.json()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/requests/models.py", line 892, in json
return complexjson.loads(self.text, **kwargs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/init.py", line 354, in loads
return _default_decoder.decode(s)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/json/decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 2 column 1 (char 2)
Yo

Cannot get to run certain methods (get_open_orders, limit_buy, etc.)

Nice wrapper, thanks for sharing this with community.

I cannot get to run most of private requests such as get_open_orders. I have read a similar issue posted above and I confirm my private & public keys are correct because I can run client.get_balances() with no issues.

from btcturk import Btcturk
client = Btcturk('XXX-914b78f84fc3', 'XXX')

client.get_balances()
{'btc_available': 0.0,
'btc_balance': 0.0,
'btc_reserved': 0.0,
'btctry_maker_fee_percentage': 0.001694915,
'btctry_taker_fee_percentage': 0.002542373,
'eth_available': 0.0,
'eth_balance': 0.0,
'eth_reserved': 0.0,
'ethbtc_maker_fee_percentage': 0.001694915,
'ethbtc_taker_fee_percentage': 0.002542373,
'ethtry_maker_fee_percentage': 0.0,
'ethtry_taker_fee_percentage': 0.001694915,
'ltc_available': 0.0,
'ltc_balance': 0.0,
'ltc_reserved': 0.0,
'ltctry_maker_fee_percentage': 0.001694915,
'ltctry_taker_fee_percentage': 0.002542373,
'try_available': 288.11,
'try_balance': 789.11,
'try_reserved': 500.99,
'usdt_available': 0.0,
'usdt_balance': 0.0,
'usdt_reserved': 0.0,
'usdttry_maker_fee_percentage': 0.001694915,
'usdttry_taker_fee_percentage': 0.002542373,
'xlm_available': 0.0,
'xlm_balance': 0.0,
'xlm_reserved': 0.0,
'xlmtry_maker_fee_percentage': 0.001694915,
'xlmtry_taker_fee_percentage': 0.002542373,
'xrp_available': 0.0,
'xrp_balance': 0.0,
'xrp_reserved': 0.0,
'xrptry_maker_fee_percentage': 0.001694915,
'xrptry_taker_fee_percentage': 0.002542373}

client.get_open_orders("ETHTRY")
Traceback (most recent call last):

File "", line 1, in
client.get_open_orders("ETHTRY")

File "C:\Users\fizbe\Anaconda3\envs\arbitrage\lib\site-packages\btcturk\btcturk.py", line 155, in get_open_orders
return self._make_request(method="GET", path="openOrders", params=params)

File "C:\Users\fizbe\Anaconda3\envs\arbitrage\lib\site-packages\btcturk\btcturk.py", line 41, in _make_request
return resp.json()

File "C:\Users\fizbe\Anaconda3\envs\arbitrage\lib\site-packages\requests\models.py", line 896, in json
return complexjson.loads(self.text, **kwargs)

File "C:\Users\fizbe\Anaconda3\envs\arbitrage\lib\json_init_.py", line 319, in loads
return _default_decoder.decode(s)

File "C:\Users\fizbe\Anaconda3\envs\arbitrage\lib\json\decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())

File "C:\Users\fizbe\Anaconda3\envs\arbitrage\lib\json\decoder.py", line 357, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None

JSONDecodeError: Expecting value

client.ticker() çalışmıyor.

kodum:

from btcturk import Btcturk
client = Btcturk()
client.ticker()

hata:

client.ticker()
Traceback (most recent call last):
File "C:\Users\ENES\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 960, in json
return complexjson.loads(self.content.decode(encoding), **kwargs)
File "C:\Users\ENES\AppData\Local\Programs\Python\Python310\lib\json_init_.py", line 346, in loads
return _default_decoder.decode(s)
337, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "C:\Users\ENES\AppData\Local\Programs\Python\Python310\lib\json\decoder.py", line 355, in raw_decode
raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "", line 1, in
File "C:\Users\ENES\AppData\Local\Programs\Python\Python310\lib\site-packages\btcturk\btcturk.py", line 66, in ticker
return self._make_request(method="GET", path="ticker", protection=False)
File "C:\Users\ENES\AppData\Local\Programs\Python\Python310\lib\site-packages\btcturk\btcturk.py", line 41, in _make_request
return resp.json()
File "C:\Users\ENES\AppData\Local\Programs\Python\Python310\lib\site-packages\requests\models.py", line 968, in json
raise RequestsJSONDecodeError(e.msg, e.doc, e.pos)
requests.exceptions.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.