Beispiel #1
0
    def __init__(self, _from: str=None, from_id: str=None, end_id: str=None, since: str=None, end: str=None,
                 pair: str=DEFAULT_TYPE, count: int=DEFAULT_COUNT, order: str=DEFAULT_ORDER, _type: str=DEFAULT_TYPE,
                 owner: str=DEFAULT_OWNER, **kwargs):

        super(GetActiveOrdersRequest, self).__init__(**kwargs)

        if count and count > DEFAULT_COUNT:
            raise ValueError('count cannot be greater than {}. Currently: {} {}'.format(DEFAULT_COUNT, count,
                                                                                        type(count)))

        request_data = {
            'pair': pair,
            'count': count,
            'order': order,
            'type': _type,
            'owner': owner
        }

        optional_none_params = {
            'from': _from,
            'from_id': from_id,
            'end_id': end_id,
            'since': since,
            'end': end
        }
        set_not_none_dict_kwargs(request_data, **optional_none_params)

        self.json.update(request_data)
Beispiel #2
0
    def __init__(self, currency: str=DEFAULT_TYPE, _from: int=None, count: int=DEFAULT_COUNT, from_id: int=None,
                 end_id: int=None, order: str=DEFAULT_ORDER, since: str=None, end: str=None,
                 status: int=ORDER_STATUS.FINISHED, **kwargs):
        super(TransactionHistoryRequest, self).__init__(**kwargs)

        # FIXME: similar to StockExchangeGetActiveOrdersRequest

        if count and count > DEFAULT_COUNT:
            raise ValueError('count cannot be greater than {}. Currently: {} {}'.format(DEFAULT_COUNT, count,
                                                                                        type(count)))

        request_data = {
            'currency': currency,
            'count': count,
            'order': order,
            'status': status
        }
        optional_none_params = {
            'from': _from,
            'from_id': from_id,
            'end_id': end_id,
            'since': since,
            'end': end
        }
        set_not_none_dict_kwargs(request_data, **optional_none_params)
        self.json.update(request_data)
Beispiel #3
0
    def test_set_not_none_dict_kwargs(self):
        _dict = {'a': 23, 'b': 44}

        set_not_none_dict_kwargs(_dict, c=45, d=None, e=0, f='')

        self.assertEqual(_dict['c'], 45)
        self.assertNotIn('d', _dict)
        self.assertEqual(_dict['e'], 0)
        self.assertEqual(_dict['f'], '')
Beispiel #4
0
 def __init__(self, currency1: str, currency2: str, order: str=DEFAULT_ORDER, count: int=DEFAULT_COUNT,
              interval: str=DEFAULT_INTERVAL, since: str=None, end: str=None, **kwargs):
     super(GraficPublicRequest, self).__init__(**kwargs)
     params = {
         'pair': '{}_{}'.format(currency1, currency2),
         'interval': interval,
         'order': order,
         'count': count
     }
     set_not_none_dict_kwargs(params, since=since, end=end)
     self.params.update(params)
Beispiel #5
0
    def __init__(self, pair: str=DEFAULT_TYPE, order: str=DEFAULT_ORDER, count: int=DEFAULT_COUNT,
                 interval: str=DEFAULT_INTERVAL, page: int=1, since: str=None, end: str=None, **kwargs):
        super(GraficPrivateRequest, self).__init__(**kwargs)

        # FIXME: similiar to GraficPublicRequest

        if count and count > 100:
            raise ValueError('count cannot be greater than {}. Currently: {} {}'.format(100, count,
                                                                                        type(count)))

        request_data = {
            'pair': pair,
            'order': order,
            'count': count,
            'interval': interval,
            'page': page
        }
        set_not_none_dict_kwargs(request_data, since=since, end=end)

        self.json.update(request_data)