Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up

crypto currency library for trading & market making bots, account management, and data analysis

License

NotificationsYou must be signed in to change notification settings

zbarge/stocklook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

57 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

A collection of utilities for working with cryptocurrency APIs.

Goal: Painless automated spread and target trading, account management, and data analysis.

APIs:

  • BitMex (stocklook.crypto.bitmex): trading, account management, websocket feed
  • Bittrex (stocklook.crypto.bittrex): account management, buy/sell
  • blockchain.io (stocklook.crypto.bitcoin): BTC blockchain stats
  • blockcypher.com (stocklook.crypto.etherium): ETH blockchain stats
  • CoinBase (stocklook.crypto.coinbase_api): account management, buy/sell
  • CoinMarketCap (stocklook.crypto.coinmarketcap): price history, market stats
  • Cryptopia (stocklook.crypto.cryptopia): price history, buy/sell, market stats
  • Gdax (stocklook.crypto.gdax): trading, account management, price history, websocket feed
  • Poloniex (stocklook.crypto.poloniex): price history
  • Twitter (stocklook.apis.twitah): tweet scanning
  • Yahoo Finance (broken): price history

Examples

Accessing Coinbase to view accounts:

from stocklook.crypto.coinbase_api import CoinbaseClientc = CoinbaseClient()# method 1 - access accounts via coinbase libraryobj = c.get_accounts()accounts = obj.response.json['data']for account in accounts:    print("{}: {}".format(account['currency']: account['id'])# method 2 - parses accounts into dictionary upon access.usd_account = c.accounts['USD']

Accessing Gdax to buy some coin:

from stocklook.crypto.gdax import Gdax, GdaxOrderg = Gdax()g.deposit_from_coinbase('USD', 100)o = GdaxOrder(g, 'LTC-USD', order_type='market', amount=100)o.post()

Market making spreads on Gdax:

from stocklook.crypto.gdax.market_maker import GdaxMarketMakerm = GdaxMarketMaker(product_id='ETH-USD',                    min_spread=0.10,                    max_spread=0.30,                    max_buy_orders=10,                    max_sell_orders=30,)m.run()

Accessing Poloniex chart data:

# In progress

Configuration:

Configuration variables are stored in global variable stocklook.config.config(dict). User input may be requiredon Object initialization to figure out credentials unless they've been previously cached or added to this dictionary.Passwords & secrets are always cached safely using the keyring library.

Update os.environ with the following credentials to have them auto-update config:

  • coinbase: COINBASE_KEY
  • poloniex: POLONIEX_KEY
  • GDAX: GDAX_KEY
  • GMAIL: STOCKLOOK_EMAIL

You can update global configuration like so:

from stocklook.config import update_config, configmy_config = {    'DATA_DIRECTORY': 'C:/Users/me/stocklook_data'    'COINBASE_KEY': 'mycoinbasekey',    'COINBASE_SECRET': 'mycoinbasesecret',    'GDAX_KEY': 'mygdaxkey',    'GDAX_SECRET': 'mygdaxsecret',    'GDAX_PASSPHRASE': 'mygdaxpassphrase',    'GMAIL_EMAIL': 'mygmailemail@gmail.com',    'GMAIL_PASSWORD': 'mygmailpassword',    'LOG_LEVEL': logging.DEBUG,    'PYTZ_TIMEZONE': 'US/Pacific',    # SQLAlchemy URL kwargs    'GDAX_FEED_URL_KWARGS': {                            'drivername': 'mysql+pymysql',                            'host': 'localhost',                            'port': None,                            'username': 'dbuser',                            'password': 'dbpass',                            'database': 'dbname'                           },}# method 1update_config(my_config)# method 2 (same as method 1)config.update(my_config)

To-do List:

  • [] Add tests for gdax, coinbase
  • [] fix yahoo api
  • [] add Poloniex account management code

[8]ページ先頭

©2009-2025 Movatter.jp