def list(self): ''' list all open orders func ''' url= 'https://coincheck.jp/api/exchange/orders/opens' headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.get(url,headers=headers) return r.text
def all_histories(self): ''' show all payment histories ''' limit = 25 url = 'https://coincheck.com/api/exchange/orders/' \ 'transactions_pagination?limit=%s' % limit histories = [] starting_after = None while (True): _url = url if starting_after: _url = "%s&starting_after=%s" % (url, starting_after) headers = make_header( _url, access_key=self.access_key, secret_key=self.secret_key, ) r = requests.get( _url, headers=headers, ) data = json.loads(r.text) if not data.get("data"): return histories histories.extend(data.get("data")) starting_after = histories[-1].get("id")
def list(self): ''' list all open orders func ''' url= 'https://coincheck.com/api/exchange/orders/opens' headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.get(url,headers=headers) return json.loads(r.text)
def history(self): ''' show payment history ''' url= 'https://coincheck.com/api/exchange/orders/transactions' headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.get(url,headers=headers) return json.loads(r.text)
def history(self): ''' show payment history ''' url= 'https://coincheck.jp/api/exchange/orders/transactions' headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.get(url,headers=headers) return r.text
def cancel(self,order_id): ''' cancel the specified order :param order_id: order_id to be canceled ''' url= 'https://coincheck.jp/api/exchange/orders/' + order_id headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.delete(url,headers=headers) return r.text
def leverage_positions(self, status): ''' show leverage positions :param status: str; 'open' or 'closed' ''' url= 'https://coincheck.com/api/exchange/leverage/positions?status=' + status headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.get(url,headers=headers) return json.loads(r.text)
def cancel(self,order_id): ''' cancel the specified order :param order_id: order_id to be canceled ''' url= 'https://coincheck.com/api/exchange/orders/' + order_id headers = make_header(url,access_key=self.access_key,secret_key=self.secret_key) r = requests.delete(url,headers=headers) return json.loads(r.text)
def get_balance(self): ''' confirm balance ''' url = 'https://coincheck.com/api/accounts/balance' headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) r = requests.get(url, headers=headers) return json.loads(r.text)
async def history(self): """ show payment history """ url = "https://coincheck.com/api/exchange/orders/transactions" headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as res: text = await res.text() return json.loads(text)
async def list(self): """ list all open orders func """ url = "https://coincheck.com/api/exchange/orders/opens" headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as res: text = await res.text() return json.loads(text)
def get_leverage_balance(self): '''Check your leverage account's balance. ''' url = 'https://coincheck.com/api/accounts/leverage_balance' headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) r = requests.get(url, headers=headers) return json.loads(r.text)
async def cancel(self, order_id): """ cancel the specified order :param order_id: order_id to be canceled """ url = "https://coincheck.com/api/exchange/orders/" + order_id headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) async with aiohttp.ClientSession() as session: async with session.delete(url, headers=headers) as res: text = await res.text() return json.loads(text)
def get_balance(self): ''' confirm balance ''' url = 'https://coincheck.jp/api/accounts/balance' headers = make_header(url, access_key = self.access_key, secret_key = self.secret_key) r = requests.get(url, headers = headers) return r.text
def history_pagination(self, **kwargs): ''' show payment history :param limit: You can specify the number of acquisition per page. :param order: You can specify "desc" or "asc". :param starting_after: If you specify the ID you can set the start point of list. :param ending_before: If you specify the ID you can set the start point of list. ''' url= 'https://coincheck.com/api/exchange/orders/transactions_pagination?' + make_body(**kwargs) headers = make_header(url, access_key=self.access_key,secret_key=self.secret_key) r = requests.get(url,headers=headers) return json.loads(r.text)
def get_withdraws(self): ''' get withdraws ''' url = 'https://coincheck.com/api/withdraws' headers = make_header(url, access_key = self.access_key, secret_key = self.secret_key) r = requests.get(url, headers = headers, ) return json.loads(r.text)
def get_info(self): ''' show user information ''' url = 'https://coincheck.com/api/accounts' headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) r = requests.get(url, headers=headers) return json.loads(r.text)
async def get_balance(self): """ confirm balance """ url = "https://coincheck.com/api/accounts/balance" headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as res: text = await res.text() return json.loads(text)
def get_info(self): ''' show user information ''' url= 'https://coincheck.jp/api/accounts' headers = make_header(url, access_key = self.access_key, secret_key = self.secret_key) r = requests.get(url, headers = headers) return r.text
async def get_info(self): """ show user information """ url = "https://coincheck.com/api/accounts" headers = make_header(url, access_key=self.access_key, secret_key=self.secret_key) async with aiohttp.ClientSession() as session: async with session.get(url, headers=headers) as res: text = await res.text() return json.loads(text)
def get_deposits(self, currency="BTC"): ''' get deposit money ''' url = 'https://coincheck.com/api/deposit_money' params = {"currency": currency} headers = make_header(url, access_key = self.access_key, secret_key = self.secret_key, params=params) r = requests.get(url, headers = headers, params=params, ) return json.loads(r.text)
def send(self, address="", amount=None): url = 'https://coincheck.com/api/send_money' body = { "address": address, "amount": amount, } headers = make_header(url, access_key = self.access_key, secret_key = self.secret_key, body=body, ) r = requests.post(url, body, headers=headers, ) return json.loads(r.text)
def create(self,pair, order_type, rate=None, amount=None, market_buy_amount=None, position_id=None): ''' create new order function :param pair: str; set 'btc_jpy' :param order_type: str; set 'buy' or 'sell' :param rate: float :param amount: float :param market_buy_amount: float; Market buy amount in JPY not BTC. ex) 10000 :param position_id: int ''' payload = { 'rate': rate, 'amount': amount, 'order_type': order_type, 'pair': pair, 'market_buy_amount': market_buy_amount, 'position_id': position_id, } url= 'https://coincheck.com/api/exchange/orders' body = make_body(**payload) headers = make_header(url,body=body, access_key=self.access_key,secret_key=self.secret_key) r = requests.post(url,headers=headers,data=body) return json.loads(r.text)