Skip to content

Commit 120db27

Browse files
committed
feat(client): add demoTrading urls
1 parent a9ef60d commit 120db27

1 file changed

Lines changed: 11 additions & 1 deletion

File tree

src/http-client.js

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,17 @@ import JSONbig from 'json-bigint'
66
import 'isomorphic-fetch'
77

88
const getEndpoint = (endpoints, path, testnet) => {
9-
if (testnet) return 'https://testnet.binancefuture.com'
9+
10+
const isFutures = path.includes('/fapi') || path.includes('/futures');
11+
const isDelivery = path.includes('/dapi');
12+
const isPortfolioMargin = path.includes('/papi');
13+
14+
if (testnet) {
15+
if (isFutures) return "https://demo-fapi.binance.com"
16+
if (isDelivery) return "https://demo-dapi.binance.com"
17+
if (isPortfolioMargin) return "https://demo-papi.binance.com"
18+
return "https://demo-api.binance.com"
19+
}
1020

1121
if (path.includes('/fapi') || path.includes('/futures'))
1222
return endpoints.futures || 'https://fapi.binance.com'

0 commit comments

Comments
 (0)