Skip to content

Commit b508af8

Browse files
committed
[Lint] Linter fixes
1 parent f65fd38 commit b508af8

59 files changed

Lines changed: 141 additions & 79 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

examples/ts/wizardswap-create-swap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
// Example:
1111
// npx tsx examples/ts/wizardswap-create-swap.ts bc1qxy2kgdygjrsqtzq2n0yrf2493p83kkfjhx0wlh 0.5
1212

13-
import ccxt from '../../ts/ccxt.js';
13+
import ccxt from '../../js/ccxt.js';
1414

1515
async function main () {
1616
const btcAddress = process.argv[2];

examples/ts/wizardswap-estimate-swap.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
// Usage: npx tsx examples/ts/wizardswap-estimate-swap.ts [BASE/QUOTE] [amount]
55
// E.g.: npx tsx examples/ts/wizardswap-estimate-swap.ts XMR/BTC 1
66

7-
import ccxt from '../../ts/ccxt.js';
7+
import ccxt from '../../js/ccxt.js';
88

99
async function main () {
1010
const symbol = process.argv[2] || 'XMR/BTC';

examples/ts/wizardswap-fetch-currencies.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
// WizardSwap — fetch all supported currencies
22
// No API key needed
33

4-
import ccxt from '../../ts/ccxt.js';
4+
import ccxt from '../../js/ccxt.js';
55

66
async function main () {
77
const exchange = new ccxt.wizardswap ();

python/ccxt/async_support/ob_binance.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
from ccxt.base.errors import ExchangeError
1111
from ccxt.base.errors import AuthenticationError
1212
from ccxt.base.errors import PermissionDenied
13+
from ccxt.base.errors import OBOrderUncancellableError
1314
from ccxt.base.errors import OrderImmediatelyFillable
1415
from ccxt.base.errors import NotSupported
15-
from ccxt.base.errors import OBOrderUncancellableError
1616

1717

1818
class ob_binance(binance, ImplicitAPI):
@@ -91,6 +91,16 @@ def describe(self) -> Any:
9191
})
9292

9393
def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, amount: float, price: Num = None, params={}):
94+
"""
95+
Spot market sells keep base quantity; strip reference price before delegating(OctoBot Binance parity).
96+
@param symbol Symbol passed through.
97+
@param type Order type passed through.
98+
@param side Order side passed through.
99+
@param amount Amount passed through.
100+
@param price Optional limit/reference price(cleared for spot market sells).
101+
@param params Extra parameters passed through.
102+
:returns: Result of parent `createOrderRequest`.
103+
"""
94104
market = self.market(symbol)
95105
effectivePrice = price
96106
if self.safe_bool(market, 'spot', False) and type.upper() == 'MARKET' and side.upper() == 'SELL':
@@ -101,6 +111,8 @@ def create_order_request(self, symbol: str, type: OrderType, side: OrderSide, am
101111
def uses_demo_trading_instead_of_sandbox(self, exchangeType: Str) -> Bool:
102112
"""
103113
Binance futures use demo trading instead of classic sandbox(OctoBot binance tentacle); accept `futures` spelling too.
114+
@param exchangeType Exchange subtype string from options or caller.
115+
:returns: Whether demo-trading semantics apply(`future` / `futures`).
104116
"""
105117
normalized = str(exchangeType or '').lower()
106118
return(normalized == 'future') or (normalized == 'futures')

python/ccxt/async_support/ob_coinbase.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,13 @@ async def create_order(self, symbol: str, type: OrderType, side: OrderSide, amou
120120
Coinbase only supports stop-limit orders, not stop-market(`coinbase#createOrder` throws).
121121
OctoBot `Coinbase._create_market_stop_loss_order`: limit stop-loss with limit = trigger * 0.98
122122
(STOP_LIMIT_ORDER_INSTANT_FILL_PRICE_RATIO in coinbase_exchange.py).
123+
@param symbol Symbol passed through.
124+
@param type Order type passed through(market stop-loss is rewritten to limit).
125+
@param side Order side passed through.
126+
@param amount Amount passed through.
127+
@param price Limit price passed through when no stop-loss synthesis applies.
128+
@param params Extra parameters(`stopLossPrice` / `stopPrice` trigger handling).
129+
:returns: Created order from the underlying Coinbase implementation.
123130
"""
124131
normalizedType = str(type).upper()
125132
if normalizedType == 'MARKET':

python/ccxt/async_support/ob_hyperliquid.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,8 @@ def ob_bump_hyperliquid_cost_min(self, market: Market) -> Market:
5353
"""
5454
Bump `limits.cost.min` by 10%(same intent HyperLiquidCCXTAdapter.fix_market_status):
5555
Hyperliquid may reject orders that are only slightly above the advertised minimum notional.
56+
@param market Parsed market structure from CCXT.
57+
:returns: Market with adjusted minimum cost limit when applicable.
5658
"""
5759
marketDict = market
5860
limits = self.safe_dict(marketDict, 'limits', {})

python/ccxt/async_support/ob_kucoin.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from typing import List
1010
from ccxt.base.errors import PermissionDenied
1111
from ccxt.base.errors import OBIPWhitelistError
12-
from ccxt.base.errors import OperationFailed
1312
from ccxt.base.errors import OBClosedPositionError
1413
from ccxt.base.errors import OBOrderUncancellableError
14+
from ccxt.base.errors import OperationFailed
1515

1616

1717
class ob_kucoin(kucoin, ImplicitAPI):
@@ -101,6 +101,8 @@ def ob_apply_kucoin_min_funds_cost_min(self, market: Market) -> Market:
101101
"""
102102
Raise `limits.cost.min` to at least `info.minFunds` when present(OctoBot Kucoin `get_market_status`).
103103
(spot only)
104+
@param market Parsed spot market structure.
105+
:returns: Market with reconciled minimum cost limits.
104106
"""
105107
marketDict = market
106108
info = self.safe_dict(marketDict, 'info', {})
@@ -136,7 +138,7 @@ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit:
136138
effectiveLimit = 200
137139
return await super(ob_kucoin, self).fetch_open_orders(symbol, since, effectiveLimit, params)
138140

139-
def supports_native_edit_order(self, order_type: Str, symbol: Str) -> Bool:
141+
def supports_native_edit_order(self, _order_type: Str, symbol: Str) -> Bool:
140142
return False
141143

142144
def fetch_stop_order_in_different_request(self, symbol: Str) -> Bool:

python/ccxt/async_support/ob_kucoinfutures.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
from typing import List
1010
from ccxt.base.errors import PermissionDenied
1111
from ccxt.base.errors import OBIPWhitelistError
12-
from ccxt.base.errors import OperationFailed
1312
from ccxt.base.errors import OBClosedPositionError
1413
from ccxt.base.errors import OBOrderUncancellableError
14+
from ccxt.base.errors import OperationFailed
1515

1616

1717
class ob_kucoinfutures(kucoinfutures, ImplicitAPI):
@@ -107,7 +107,7 @@ async def fetch_open_orders(self, symbol: Str = None, since: Int = None, limit:
107107
effectiveLimit = 200
108108
return await super(ob_kucoinfutures, self).fetch_open_orders(symbol, since, effectiveLimit, params)
109109

110-
def supports_native_edit_order(self, order_type: Str, symbol: Str) -> Bool:
110+
def supports_native_edit_order(self, _order_type: Str, symbol: Str) -> Bool:
111111
return False
112112

113113
def fetch_stop_order_in_different_request(self, symbol: Str) -> Bool:

python/ccxt/async_support/ob_mexc.py

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,8 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N
9797
url = self.urls['api'][section][access] + '/api/' + self.version + '/' + path
9898
urlParams = params
9999
# ob_mexc local override: begin(diff vs mexc.sign) — spot/broker force signing(see mexc_exchange _force_sign ~80-90)
100-
if True or access == 'private':
100+
# Same truth value as `true or …` here: we only reach self block when forced signing is enabled.
101+
if enableForcedSigningAllRequests or access == 'private':
101102
if section == 'broker' and ((method == 'POST') or (method == 'PUT') or (method == 'DELETE')):
102103
urlParams = {
103104
'timestamp': self.nonce(),
@@ -111,7 +112,7 @@ def sign(self, path, api='public', method='GET', params={}, headers=None, body=N
111112
if urlParams:
112113
paramsEncoded = self.urlencode(urlParams)
113114
url += '?' + paramsEncoded
114-
if True or access == 'private':
115+
if enableForcedSigningAllRequests or access == 'private':
115116
self.check_required_credentials()
116117
signature = self.hmac(self.encode(paramsEncoded), self.encode(self.secret), hashlib.sha256)
117118
url += '&' + 'signature=' + signature
@@ -187,8 +188,11 @@ def parse_order(self, order: dict, market: Market = None) -> Order:
187188
fee = self.safe_dict(parsed, 'fee')
188189
if status == 'canceled' and fee is None:
189190
quoteCcy = self.ob_quote_from_symbol(self.safe_string(parsed, 'symbol', ''))
191+
feeCurrency = ''
192+
if quoteCcy is not None:
193+
feeCurrency = quoteCcy
190194
parsed['fee'] = {
191-
'currency': quoteCcy is not quoteCcy if None else '',
195+
'currency': feeCurrency,
192196
'cost': 0,
193197
}
194198
return parsed

python/ccxt/base/exchange.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6597,7 +6597,8 @@ def create_expired_option_market(self, symbol: str):
65976597
def ob_is_strict_finite_number(self, n: Num):
65986598
if n is None:
65996599
return False
6600-
# Reject NaN and infinities using(n==n) and (n-n)==0; avoid number-type guards here
6600+
# Reject NaN and infinities using(n==n) and (n-n)==0; transpiler-safe for Python(Number.isFinite is not).
6601+
# eslint-disable-next-line no-self-compare -- intentional NaN check(NaN != NaN); Infinity − Infinity is NaN in JS
66016602
return(n == n) and ((n - n) == 0)
66026603

66036604
def ob_coerce_scalar_to_float_strict(self, raw: Any):
@@ -8277,12 +8278,12 @@ def is_uta_enabled(self, params={}):
82778278
def ob_resolve_rights_from_imaginary_cancel_catch(self, e: Any, rights: List[str], authPermissionMatch: Str):
82788279
# octobot specific
82798280
if isinstance(e, AuthenticationError):
8280-
low = str(e).lower()
8281+
authenticationErrorLower = str(e).lower()
82818282
if authPermissionMatch == 'pair':
8282-
if low.find('permission') >= 0 and low.find('denied') >= 0:
8283+
if authenticationErrorLower.find('permission') >= 0 and authenticationErrorLower.find('denied') >= 0:
82838284
return rights
82848285
else:
8285-
if low.find('permission') >= 0 or low.find('denied') >= 0:
8286+
if authenticationErrorLower.find('permission') >= 0 or authenticationErrorLower.find('denied') >= 0:
82868287
return rights
82878288
raise e
82888289
if isinstance(e, NetworkError):

0 commit comments

Comments
 (0)