aboutsummaryrefslogtreecommitdiff
path: root/market.py
blob: 08838a7f971537975037790a63ef665cd0a82c05 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
import ccxt_wrapper as ccxt

market = ccxt.poloniexE({
    "apiKey": "XXXXXXXX-XXXXXXXX-XXXXXXXX-XXXXXXXX",
    "secret": "1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    })


# For requests logging
requests = []
market.session.origin_request = market.session.request

def request_wrap(self, *args, **kwargs):
    r = self.origin_request(*args, **kwargs)
    requests.append({
        "method": args[0],
        "url": args[1],
        "body": kwargs["data"],
        "headers": kwargs["headers"],
        "status": r.status_code,
        "response": r.text,
        })
    return r
market.session.request = request_wrap.__get__(market.session, market.session.__class__)