def continuous_logging(product, path_pattern):
    setup_logging(product, path_pattern)
    wsClient = gdax.WebsocketClient(url="wss://ws-feed.gdax.com",
                                    products=[product])
    wsClient.on_message = on_message
    wsClient.on_close = on_close
    wsClient.start_and_wait()
    def init_market(self, market, secondary_markets, socket=""):
        self.loggerList[0].info('Launching public markets ...')
        self.market = []
        try:
            self.loggerList[0].info("Starting public socket")
            self.market.append(gdax.WebsocketClient(url="wss://ws-feed.gdax.com", products="BTC-EUR"))
            self.market.append(gdax.OrderBook("BTC-EUR"))
            return
            
            exec('import public_markets.' + market.lower() + ', public_markets.cryptowatch')

            # import market
            main = eval('public_markets.' + market.lower() + '.' + market + '(self.loggerList)')
            self.market.append(main)
            self.loggerList[0].info('Finished importing public market: {}'.format(market))

            # import secondary market sources
            for site in secondary_markets:
                secondary = eval('public_markets.' + site.lower() + '.' + site + '(self.loggerList)')
                self.market.append(secondary)
                self.loggerList[0].info('Finished importing public market: {}'.format(site))
        except(ImportError, AttributeError) as e:
            self.loggerList[0].error('Failed to import public market.')
            self.loggerList[0].error('Error: {}'.format(e))
Esempio n. 3
0
# -*- coding: utf-8 -*-
import logging
import os
logger = logging.getLogger(__name__)

import gdax

wsClient = gdax.WebsocketClient(url="wss://ws-feed.gdax.com",
                                products="BTC-USD",
                                channel)


def on_message(msg):
    print(msg)


wsClient.on_message = on_message
wsClient.start()
#wsClient.close()
Esempio n. 4
0
            if h['product_id'] == p:
                found = True
                continue
        if found == False:
            return False
    return True


short_history = [0]
#products = ['BTC-USD', 'BTC-EUR','ETH-USD','ETH-BTC', 'ETH-EUR','LTC-USD','LTC-BTC', 'LTC-EUR', ]
products = ['BTC-USD', 'ETH-USD', 'ETH-BTC', 'LTC-USD', 'LTC-BTC']
currencies = ['BTC', 'ETH', 'LTC', 'USD']
web_client = gdax.WebsocketClient(mongo_collection=short_history,
                                  message_type='subscribe',
                                  should_print=False,
                                  channels=[{
                                      "name": "ticker",
                                      "product_ids": products
                                  }])
web_client.start()
time.sleep(10)

Simulation = True
fee = 0

if not Simulation:
    key = 'key'
    b64secret = 'secret'
    passphrase = 'pass'
    my_client = gdax.authenticated_client(
        key,
Esempio n. 5
0
import gdax  #https://github.com/danpaquin/gdax-python
from pymongo import MongoClient

public_client = gdax.PublicClient()
mongo_client = MongoClient('mongodb://localhost:27017/')

precio = public_client.get_product_ticker(product_id='ETH-EUR')
print(precio['price'])

# Paramaters are optional
wsClient = gdax.WebsocketClient(url="wss://ws-feed.gdax.com",
                                products=["BTC-EUR", "ETH-EUR"])

# specify the database and collection
db = mongo_client.cryptocurrency_database
BTC_collection = db.BTC_collection

# Do other stuff...
wsClient.close()
Esempio n. 6
0
# import PyMongo and connect to a local, running Mongo instance
from pymongo import MongoClient
import gdax
mongo_client = MongoClient('mongodb://localhost:27017/')

# specify the database and collection
db = mongo_client.cryptocurrency_database
BTC_collection = db.BTC_collection

# instantiate a WebsocketClient instance, with a Mongo collection as a parameter
wsClient = gdax.WebsocketClient(url="wss://ws-feed.gdax.com",
                                products="LTC-USD",
                                mongo_collection=BTC_collection,
                                should_print=False)
wsClient.start()
Esempio n. 7
0
from pymongo import MongoClient
import gdax, time
mongo_client = MongoClient('mongodb://localhost:27017/')

# specify the database and collection
db = mongo_client.ordrbkdb
eth_usd_coll = db.eth_usd_coll

# instantiate a WebsocketClient instance, with a Mongo collection as a parameter
wsClient = gdax.WebsocketClient(url="wss://ws-feed.gdax.com",
                                products=["ETH-USD"],
                                mongo_collection=eth_usd_coll,
                                should_print=False)

wsClient.start()

wsClient.close()


# Test
class myWebsocketClient(gdax.WebsocketClient):
    def on_open(self):
        self.url = "wss://ws-feed.gdax.com/"
        self.products = ["LTC-USD"]
        self.message_count = 0
        print("Lets count the messages!")

    def on_message(self, msg):
        self.message_count += 1
        if 'price' in msg and 'type' in msg:
            print("Message type:", msg["type"],
Esempio n. 8
0
def use_gdax_websocket_client(key_dict, crypto_symbol):
    auth_client = gdax.AuthenticatedClient(key_dict['gdax_key'], key_dict['gdax_api_secret'], key_dict['gdax_passphrase'])
    wsClient = gdax.WebsocketClient(url="wss://ws-feed.gdax.com", products=["BTC-USD", "ETH-USD"])
Esempio n. 9
0
import gdax, time
import http.client


class Ticker:
    def __init__(self, type):
        public_client = gdax.PublicClient()
        public_client.get_product_ticker(product_id=type)


ticker = Ticker('ETH-USD')
wsClient = gdax.WebsocketClient(url="wss://ws-feed.gdax.com",
                                products="ETH-USD")

f = open("D:/MEW/SapkGDX.txt")
lines = f.readlines()
b64secret = lines[0]

f = open("D:/MEW/apk.txt")
lines = f.readlines()
key = lines[0].strip()
passphrase = lines[1].strip()

auth_client = gdax.AuthenticatedClient(key, b64secret, passphrase)

order_book = gdax.OrderBook(product_id='ETH-USD')
order_book.start()

time.sleep(2)
prevbook = order_book.get_current_book()
file = open("C:/Users/Tim/Desktop/testfile.txt", "w+")
Esempio n. 10
0
 def __init__(self, currencyPair='ETH-BTC'):
     self.client = gdax.WebsocketClient(url="wss://ws-feed.gdax.com", products=currencyPair)