mirror of
https://github.com/discountry/ritmex-bot.git
synced 2026-09-11 01:08:07 +00:00
commit
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
- [Source Ip Address](./examples/py/)
|
||||
|
||||
|
||||
```python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import sys
|
||||
import requests
|
||||
from pprint import pprint
|
||||
|
||||
|
||||
import ccxt # noqa: E402
|
||||
|
||||
|
||||
# configure the source IP address
|
||||
ip_address = '192.168.1.2' # YOUR EXTERNAL IP ADDRESS HERE
|
||||
session = requests.Session()
|
||||
for prefix in ('http://', 'https://'):
|
||||
session.get_adapter(prefix).init_poolmanager(
|
||||
# those are default values from HTTPAdapter's constructor
|
||||
connections=requests.adapters.DEFAULT_POOLSIZE,
|
||||
maxsize=requests.adapters.DEFAULT_POOLSIZE,
|
||||
# This should be a tuple of (address, port). Port 0 means auto-selection.
|
||||
source_address=(ip_address, 0),
|
||||
)
|
||||
|
||||
|
||||
exchange = ccxt.ftx({
|
||||
'session': session,
|
||||
# ... other config properties here if necessary ...
|
||||
})
|
||||
|
||||
|
||||
markets = exchange.load_markets()
|
||||
exchange.verbose = True
|
||||
|
||||
ticker = exchange.fetch_ticker('BTC/USD')
|
||||
pprint(ticker)
|
||||
|
||||
```
|
||||
Reference in New Issue
Block a user