예제 #1
0
파일: order.py 프로젝트: hmmgit/coincheck
 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
예제 #2
0
    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")
예제 #3
0
 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)
예제 #4
0
 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)
예제 #5
0
파일: order.py 프로젝트: hmmgit/coincheck
 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
예제 #6
0
파일: order.py 프로젝트: hmmgit/coincheck
 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
예제 #7
0
 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)
예제 #8
0
 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)
예제 #9
0
 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)
예제 #10
0
 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)
예제 #11
0
 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)
예제 #12
0
 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)
예제 #13
0
 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)
예제 #14
0
파일: account.py 프로젝트: hmmgit/coincheck
 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
예제 #15
0
 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)
예제 #16
0
 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)
예제 #17
0
    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)
예제 #18
0
 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)
예제 #19
0
파일: account.py 프로젝트: hmmgit/coincheck
    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
예제 #20
0
    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)
예제 #21
0
 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)
예제 #22
0
 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)
예제 #23
0
 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)