Crawl in TradeDerby using (Headless) Chrome.
- Install Chrome
- Download chromedriver from download page.
- You can use pip.
$ pip install TradeDerPy
- Or git clone.
$ git clone https://github.com/nabehide/TradeDerPy.git
$ cd TradeDerPy
$ pip install -r requirements.txt
$ python setup.py install
from TradeDerPy import TradeDerPy
account = {"username": "YOUR_USERNAME", "password": "YOUR_PASSWORD"}
config = {
"headless": True,
"debug": True,
"driverPath": "./chromedriver",
}
td = TradeDerPy(account, config)
td.open()
td.login()
td.getStatus()
td.showStatus()
td.getHold()
td.showHold()
td.getOrder()
td.showOrder()
td.getSuggested()
td.showSuggested()
td.getSuggested()
if len(td.suggested) != 0:
idx = 0
name = td.suggested["name"][idx]
maximum = 1000000
td.buy(name, maximum)
td.getHold()
if len(td.hold) != 0:
idx = 0
name = td.hold["name"][0]
url = td.hold["sellURL"][0]
td.sell(name, url)
td.close()
- Please refer to examples.