Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 15 additions & 20 deletions kucoin/async_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -469,12 +469,8 @@ async def get_symbol(self, symbol=None, **params):

"""

data = {}
if symbol:
data["symbol"] = symbol

return await self._get(
"symbol", False, api_version=self.API_VERSION2, data=dict(data, **params)
"symbols/{}".format(symbol), False, api_version=self.API_VERSION2, **params
)

async def get_ticker(self, symbol, **params):
Expand Down Expand Up @@ -763,7 +759,7 @@ async def get_trade_histories(self, symbol, **params):

return await self._get("market/histories", False, data=dict(data, **params))

async def get_kline_data(self, symbol, kline_type="5min", start=None, end=None, **params):
async def get_klines(self, symbol, kline_type="5min", start=None, end=None, **params):
"""Get kline data

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-klines
Expand All @@ -773,7 +769,7 @@ async def get_kline_data(self, symbol, kline_type="5min", start=None, end=None,

:param symbol: Name of symbol e.g. KCS-BTC
:type symbol: string
:param kline_type: type of symbol, type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour,
:param kline_type: type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour,
4hour, 6hour, 8hour, 12hour, 1day, 1week
:type kline_type: string
:param start: Start time as unix timestamp (optional) default start of day in UTC
Expand All @@ -783,7 +779,7 @@ async def get_kline_data(self, symbol, kline_type="5min", start=None, end=None,

.. code:: python

klines = client.get_kline_data('KCS-BTC', '5min', 1507479171, 1510278278)
klines = client.get_klines('KCS-BTC', '5min', 1507479171, 1510278278)

:returns: ApiResponse

Expand Down Expand Up @@ -1277,7 +1273,7 @@ async def futures_get_trade_histories(self, symbol, **params):
)

async def futures_get_klines(
self, symbol, kline_type="5min", start=None, end=None, **params
self, symbol, kline_type=5, start=None, end=None, **params
):
"""Get kline data

Expand All @@ -1287,17 +1283,16 @@ async def futures_get_klines(

:param symbol: Name of symbol e.g. XBTUSDTM
:type symbol: string
:param kline_type: type of symbol, type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour,
4hour, 6hour, 8hour, 12hour, 1day, 1week
:type kline_type: string
:param kline_type: type of candlestick in minutes: 1, 5, 50 etc.
:type kline_type: int
:param start: Start time as unix timestamp (optional) default start of day in UTC
:type start: int
:param end: End time as unix timestamp (optional) default now in UTC
:type end: int

.. code:: python

klines = client.futures_get_klines('XBTUSDTM', '5min', 1507479171, 1510278278)
klines = client.futures_get_klines('XBTUSDTM', 5, 1507479171, 1510278278)

:returns: ApiResponse

Expand Down Expand Up @@ -8919,7 +8914,7 @@ async def get_fills(
if limit:
data["pageSize"] = limit

return await self._get("fills", False, data=dict(data, **params))
return await self._get("fills", True, data=dict(data, **params))

async def get_recent_fills(self, **params):
"""Get a list of recent fills.
Expand Down Expand Up @@ -9232,7 +9227,7 @@ async def futures_get_fills(
if limit:
data["pageSize"] = limit

return await self._get("fills", False, is_futures=True, data=dict(data, **params))
return await self._get("fills", True, is_futures=True, data=dict(data, **params))

async def futures_get_recent_fills(self, symbol=None, **params):
"""Get a list of recent futures fills.
Expand Down Expand Up @@ -9287,7 +9282,7 @@ async def futures_get_recent_fills(self, symbol=None, **params):
data["symbol"] = symbol

return await self._get(
"recentFills", False, is_futures=True, data=dict(data, **params)
"recentFills", True, is_futures=True, data=dict(data, **params)
)

async def futures_get_active_order_value(self, symbol, **params):
Expand Down Expand Up @@ -9324,7 +9319,7 @@ async def futures_get_active_order_value(self, symbol, **params):
data = {"symbol": symbol}

return await self._get(
"openOrderStatistics", False, is_futures=True, data=dict(data, **params)
"openOrderStatistics", True, is_futures=True, data=dict(data, **params)
)

# Margin Info Endpoints
Expand Down Expand Up @@ -9378,7 +9373,7 @@ async def margin_get_leverage_token_info(self, currency=None, **params):
async def margin_get_all_trading_pairs_mark_prices(self, **params):
"""Get a list of trading pairs and their mark prices

https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-trading-pairs-mark-price
https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices

.. code:: python

Expand Down Expand Up @@ -10295,7 +10290,7 @@ async def margin_lending_get_currency_info(self, currency=None, **params):

return await self._get(
"project/list",
False,
True,
api_version=self.API_VERSION3,
data=dict(data, **params),
)
Expand Down Expand Up @@ -10341,7 +10336,7 @@ async def margin_lending_get_interest_rate(self, currency, **params):

return await self._get(
"project/marketInterestRatet",
False,
True,
api_version=self.API_VERSION3,
data=dict(data, **params),
)
Expand Down
39 changes: 17 additions & 22 deletions kucoin/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -361,13 +361,13 @@ def get_symbols(self, market=None, **params):

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-symbols-list

:param market: (optional) Name of market e.g. BTC
:param market: (optional) Name of market e.g. ETH-USDT
:type market: string

.. code:: python

symbols = client.get_symbols()
symbols = client.get_symbols('USDS')
symbols = client.get_symbols('ETH-USDT')

:returns: ApiResponse

Expand Down Expand Up @@ -469,12 +469,8 @@ def get_symbol(self, symbol=None, **params):

"""

data = {}
if symbol:
data["symbol"] = symbol

return self._get(
"symbol", False, api_version=self.API_VERSION2, data=dict(data, **params)
"symbols/{}".format(symbol), False, api_version=self.API_VERSION2, data=params
)

def get_ticker(self, symbol, **params):
Expand Down Expand Up @@ -763,7 +759,7 @@ def get_trade_histories(self, symbol, **params):

return self._get("market/histories", False, data=dict(data, **params))

def get_kline_data(self, symbol, kline_type="5min", start=None, end=None, **params):
def get_klines(self, symbol, kline_type="5min", start=None, end=None, **params):
"""Get kline data

https://www.kucoin.com/docs/rest/spot-trading/market-data/get-klines
Expand All @@ -773,7 +769,7 @@ def get_kline_data(self, symbol, kline_type="5min", start=None, end=None, **para

:param symbol: Name of symbol e.g. KCS-BTC
:type symbol: string
:param kline_type: type of symbol, type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour,
:param kline_type: type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour,
4hour, 6hour, 8hour, 12hour, 1day, 1week
:type kline_type: string
:param start: Start time as unix timestamp (optional) default start of day in UTC
Expand All @@ -783,7 +779,7 @@ def get_kline_data(self, symbol, kline_type="5min", start=None, end=None, **para

.. code:: python

klines = client.get_kline_data('KCS-BTC', '5min', 1507479171, 1510278278)
klines = client.get_klines('KCS-BTC', '5min', 1507479171, 1510278278)

:returns: ApiResponse

Expand Down Expand Up @@ -1277,7 +1273,7 @@ def futures_get_trade_histories(self, symbol, **params):
)

def futures_get_klines(
self, symbol, kline_type="5min", start=None, end=None, **params
self, symbol, kline_type=5, start=None, end=None, **params
):
"""Get kline data

Expand All @@ -1287,17 +1283,16 @@ def futures_get_klines(

:param symbol: Name of symbol e.g. XBTUSDTM
:type symbol: string
:param kline_type: type of symbol, type of candlestick patterns: 1min, 3min, 5min, 15min, 30min, 1hour, 2hour,
4hour, 6hour, 8hour, 12hour, 1day, 1week
:type kline_type: string
:param kline_type: type of candlestick in minutes: 1, 5, 50 etc.
:type kline_type: int
:param start: Start time as unix timestamp (optional) default start of day in UTC
:type start: int
:param end: End time as unix timestamp (optional) default now in UTC
:type end: int

.. code:: python

klines = client.futures_get_klines('XBTUSDTM', '5min', 1507479171, 1510278278)
klines = client.futures_get_klines('XBTUSDTM', 5, 1507479171, 1510278278)

:returns: ApiResponse

Expand Down Expand Up @@ -8923,7 +8918,7 @@ def get_fills(
if limit:
data["pageSize"] = limit

return self._get("fills", False, data=dict(data, **params))
return self._get("fills", True, data=dict(data, **params))

def get_recent_fills(self, **params):
"""Get a list of recent fills.
Expand Down Expand Up @@ -9236,7 +9231,7 @@ def futures_get_fills(
if limit:
data["pageSize"] = limit

return self._get("fills", False, is_futures=True, data=dict(data, **params))
return self._get("fills", True, is_futures=True, data=dict(data, **params))

def futures_get_recent_fills(self, symbol=None, **params):
"""Get a list of recent futures fills.
Expand Down Expand Up @@ -9291,7 +9286,7 @@ def futures_get_recent_fills(self, symbol=None, **params):
data["symbol"] = symbol

return self._get(
"recentFills", False, is_futures=True, data=dict(data, **params)
"recentFills", True, is_futures=True, data=dict(data, **params)
)

def futures_get_active_order_value(self, symbol, **params):
Expand Down Expand Up @@ -9328,7 +9323,7 @@ def futures_get_active_order_value(self, symbol, **params):
data = {"symbol": symbol}

return self._get(
"openOrderStatistics", False, is_futures=True, data=dict(data, **params)
"openOrderStatistics", True, is_futures=True, data=dict(data, **params)
)

# Margin Info Endpoints
Expand Down Expand Up @@ -9382,7 +9377,7 @@ def margin_get_leverage_token_info(self, currency=None, **params):
def margin_get_all_trading_pairs_mark_prices(self, **params):
"""Get a list of trading pairs and their mark prices

https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-trading-pairs-mark-price
https://www.kucoin.com/docs/rest/margin-trading/margin-info/get-all-margin-trading-pairs-mark-prices

.. code:: python

Expand Down Expand Up @@ -10299,7 +10294,7 @@ def margin_lending_get_currency_info(self, currency=None, **params):

return self._get(
"project/list",
False,
True,
api_version=self.API_VERSION3,
data=dict(data, **params),
)
Expand Down Expand Up @@ -10345,7 +10340,7 @@ def margin_lending_get_interest_rate(self, currency, **params):

return self._get(
"project/marketInterestRatet",
False,
True,
api_version=self.API_VERSION3,
data=dict(data, **params),
)
Expand Down
Loading
Loading