├── .gitignore ├── .travis.yml ├── LICENSE ├── README.md ├── docs └── index.html.in └── python ├── common.py ├── tv_watchlist_binance_btc.py └── tv_watchlist_bittrex_btc.py /.gitignore: -------------------------------------------------------------------------------- 1 | /.project 2 | /.pydevproject 3 | -------------------------------------------------------------------------------- /.travis.yml: -------------------------------------------------------------------------------- 1 | language: python 2 | 3 | python: 2.7 4 | 5 | branches: 6 | only: 7 | - master 8 | 9 | script: 10 | - mkdir pages 11 | - python python/tv_watchlist_binance_btc.py > pages/binance_btc.txt 12 | - python python/tv_watchlist_bittrex_btc.py > pages/bittrex_btc.txt 13 | - sed "s/_BUILDTIMESTAMP_/`date`/g" docs/index.html.in > pages/index.html 14 | 15 | deploy: 16 | provider: pages 17 | skip-cleanup: true 18 | github-token: $GITHUB_TOKEN 19 | keep-history: true 20 | on: 21 | branch: master 22 | local-dir: pages 23 | 24 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | This is free and unencumbered software released into the public domain. 2 | 3 | Anyone is free to copy, modify, publish, use, compile, sell, or 4 | distribute this software, either in source code form or as a compiled 5 | binary, for any purpose, commercial or non-commercial, and by any 6 | means. 7 | 8 | In jurisdictions that recognize copyright laws, the author or authors 9 | of this software dedicate any and all copyright interest in the 10 | software to the public domain. We make this dedication for the benefit 11 | of the public at large and to the detriment of our heirs and 12 | successors. We intend this dedication to be an overt act of 13 | relinquishment in perpetuity of all present and future rights to this 14 | software under copyright law. 15 | 16 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 17 | EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 18 | MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 19 | IN NO EVENT SHALL THE AUTHORS BE LIABLE FOR ANY CLAIM, DAMAGES OR 20 | OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 21 | ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 22 | OTHER DEALINGS IN THE SOFTWARE. 23 | 24 | For more information, please refer to 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # TradingViewTools 2 | Some scripts to automate things related to TradingView 3 | 4 | # What you can find here 5 | Look at the directory 'python' to see which scripts exist so far :) 6 | 7 | To create a TradingView watchlist of the BTC markets at Bittrex, 8 | just run tv_watchlist_bittrex_btc.py and redirect the output to 9 | a txt file. Name the file the same as you want the new watchlist 10 | to be named, for example BittrexBTC.txt. Go to TradingView, click 11 | 'Import Watchlist', upload the txt file and that's it. 12 | 13 | To do the same for BTC markets at Binance, run tv_watchlist_binance_btc.py 14 | and follow the same steps. 15 | 16 | Have fun! 17 | 18 | # Automated Builds 19 | Each commit triggers a Travis build and there will soon be a cron job to create the watchlists on a weekly basis. The latest watchlists created by the automated builds are available at https://cryptonoob42.github.io/TradingViewTools/. 20 | 21 | ![Build Status](https://travis-ci.org/cryptonoob42/TradingViewTools.svg?branch=master) 22 | 23 | -------------------------------------------------------------------------------- /docs/index.html.in: -------------------------------------------------------------------------------- 1 | 2 | 3 | Latest TradingView watchlists 4 | 5 | 6 |

TradingView watchlists

7 |

Build timestamp: _BUILDTIMESTAMP_

8 |

Binance BTC markets

9 |

Bittrex BTC markets

10 | 11 | 12 | -------------------------------------------------------------------------------- /python/common.py: -------------------------------------------------------------------------------- 1 | import urllib2 2 | 3 | BASE_CURRENCY = 'BTC' 4 | 5 | 6 | def load_data(url): 7 | response = '' 8 | try: 9 | result = urllib2.urlopen(url) 10 | code = result.getcode() 11 | if code == 200: 12 | response = result.read() 13 | else: 14 | print 'Error retrieving data from URL {0} : status {1} returned.'.format(url, code) 15 | except urllib2.URLError as error: 16 | print 'Error retrieving data: {0}'.format(error.reason) 17 | 18 | return response 19 | 20 | 21 | def convert_to_watchlist(symbols): 22 | symbols.sort() 23 | print ','.join(symbols) 24 | -------------------------------------------------------------------------------- /python/tv_watchlist_binance_btc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import json 4 | 5 | from common import load_data, convert_to_watchlist, BASE_CURRENCY 6 | 7 | response = load_data('https://api.binance.com/api/v1/ticker/allPrices') 8 | if response != '': 9 | prices = json.loads(response) 10 | symbols = [] 11 | 12 | for price in prices: 13 | symbol = price['symbol'] 14 | if symbol.endswith(BASE_CURRENCY): 15 | symbols.append('BINANCE:{0}'.format(symbol)) 16 | 17 | convert_to_watchlist(symbols) 18 | -------------------------------------------------------------------------------- /python/tv_watchlist_bittrex_btc.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/python 2 | 3 | import json 4 | 5 | from common import load_data, convert_to_watchlist, BASE_CURRENCY 6 | 7 | response = load_data('https://bittrex.com/api/v1.1/public/getmarkets') 8 | if response != '': 9 | markets = json.loads(response) 10 | if markets['success'] != True: 11 | print 'Markets were retrieved, but the success flag is false.' 12 | pass 13 | 14 | tv_symbols = [] 15 | for market in markets['result']: 16 | if market['BaseCurrency'] == BASE_CURRENCY: 17 | tv_symbols.append('BITTREX:{0}{1}'.format(market['MarketCurrency'], BASE_CURRENCY)) 18 | 19 | convert_to_watchlist(tv_symbols) 20 | --------------------------------------------------------------------------------