Beispiel #1
0
    def get_all_products(self):
        res = requests.get(self.url + "products", auth = self.auth).json()

        ret = []
        for pr in res:
            pr['ir_type'] = 'order'
            ret.append(irconverter.convert(pr))

        return ret
Beispiel #2
0
    def get_accounts(self):
        res = requests.get(self.url + 'accounts', auth = self.auth).json()

        ret = []
        for acc in res:
            acc['ir_type'] = 'account'
            ret.append(irconverter.convert(acc))

        return ret
Beispiel #3
0
 def cancel_order(self, order):
     res = requests.delete(self.url + f'orders/{order.id}?product_id={order.product_id}', auth=self.auth)
     return irconverter.convert(res)
Beispiel #4
0
 def limit_order(self, limit_order):
     res = requests.post(self.url + 'orders', json=limit_order, auth=self.auth).json()
     res['ir_type'] = 'order'
     return irconverter.convert(res)
Beispiel #5
0
 def get_product_book(self, product_id, level=1):
     level_str = "" if level == 1 else f"?level={str(min(3, level))}"
     res = requests.get(self.url + f"products/{product_id}/book{level_str}", auth = self.auth)
     return irconverter.convert(res)
Beispiel #6
0
 def get_product(self, product_id):
     res = requests.get(self.url + f"products/{product_id}", auth = self.auth).json()
     res['ir_type'] = 'product'
     return irconverter.convert(res)
Beispiel #7
0
 def get_account_history(self, account_id):
     res = requests.get(self.url + f'accounts/{account_id}/ledger', auth=self.auth)
     return irconverter.convert(res)
Beispiel #8
0
 def get_account(self, account_id):
     res = requests.get(self.url + f'accounts/{account_id}', auth=self.auth).json()
     res['ir_type'] = account
     return irconverter.convert(res)