Coder Social home page Coder Social logo

easy-data-scripts's People

Contributors

bendelo avatar romeubertho avatar ryanfox avatar strml avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

easy-data-scripts's Issues

Trying to retreive trades real time

Hi guys,

I am trying to retreive all the trades real time. However for whatever reason the feed does not seem to be updating anymore after running the first time. Does anyone have any idea what I can do to fix this?

`
import argparse
import json
import time
import csv
import sys
import datetime
from lib import bitmex
from settings import API_KEY, API_SECRET, API_BASE

parser = argparse.ArgumentParser(description='Fetch your full execution trade history from BitMEX.')
parser.add_argument('--apiKey', type=str, required=(not API_KEY), default=API_KEY,
help='API Key. Generate from https://www.bitmex.com/app/apiKeys')
parser.add_argument('--apiSecret', type=str, required=(not API_SECRET), default=API_SECRET,
help='API Secret.')
parser.add_argument('--fileType', type=str, default='json',
help='Output file type. Must end be json or csv.')
parser.add_argument('--filter', type=str,
help='Query filter as JSON.')

args = parser.parse_args()

fileType = args.fileType
if fileType != 'json' and fileType != 'csv':
raise Exception('Output file type must be json or csv! Given: %s' % fileType)

if not args.apiKey or not args.apiSecret:
print('Please fill in API_KEY and API_SECRET in settings.py!\n' +
'You can create an API key from https://www.bitmex.com/app/apiKeys')
sys.exit(1)

if(args.filter):
try:
json.loads(args.filter)
except ValueError as e:
raise ValueError("Filter is not valid JSON! Make sure to single-quote the string.")

connector = bitmex.BitMEX(base_url=API_BASE, apiKey=args.apiKey, apiSecret=args.apiSecret)

count = 100 # max API will allow
today = datetime.date.today()
query = {
'reverse': 'true',
'start': 0,
'startTime': today,
'count': count,
'filter': args.filter
}

out = []
firsttime = 0
z=0
timeback=0
tijd=0
while True:
data = connector._curl_bitmex(path="execution/tradeHistory", verb="GET", query=query)
out.extend(data)
trades = json.dumps(out, sort_keys=True, indent=4, separators=(',', ': '))
trades = json.loads(trades)
number = len(trades)
x=number-1
tijd = str(trades[0]["transactTime"])
if tijd!=timeback and firsttime!=0:
side = str(trades[0]["side"])
size = str(trades[0]["cumQty"])
product = str(trades[0]["symbol"])
tijd = str(trades[0]["transactTime"])
text = str(side+' '+size+' '+product+' '+tijd)
while x>=0 and firsttime==0:
side = str(trades[x]["side"])
size = str(trades[x]["cumQty"])
product = str(trades[x]["symbol"])
tijd = str(trades[x]["transactTime"])
timeback = tijd
text = str(side+' '+size+' '+product+' '+tijd)
print (text)
x=x-1
firsttime = 1
time.sleep(5)
sys.exit()`

Python 3 - SyntaxError bitmex.py

get error using Python 3.6.2 on Win 10

command that produced error:
python fetchExecutionTradeHistory.py -h

error:

  File "fetchExecutionTradeHistory.py", line 5, in <module>
    from lib import bitmex
  File "C:\python\BitMEX-easy-data-scripts\lib\bitmex.py", line 203
    except requests.exceptions.HTTPError, e:
                                        ^
SyntaxError: invalid syntax

S

Z

IndexError: list index out of range

Having updated settings.py (API_KEY / API_SECRET) and executing the following I get an error message.

python fetchExecutionTradeHistory.py --apiKey mykey --apiSecret my-api-secret
Traceback (most recent call last):
  File "fetchExecutionTradeHistory.py", line 60, in <module>
    keys = out[0].keys()
IndexError: list index out of range

I mounted this repo using:

docker run -it -v $(pwd):/root/code python:3.5-jessie /bin/bash

The API key and secret are valid.

Not working anymore?

Damn need to do my taxes and cannot seem to get this working. With Python 3.6.5 running on OS X Sierra I get this error...

#python3 fetchExecutionTradeHistory.py > bitmex_records.csv

Traceback (most recent call last):
  File "fetchExecutionTradeHistory.py", line 5, in <module>
    from lib import bitmex
  File "/Users/xxxxxxx/Scripts/easy-data-scripts/lib/bitmex.py", line 2, in <module>
    import requests
ModuleNotFoundError: No module named 'requests'

I of course inserted my API info in settings.py. Anyone have a clue?

Stop Limit not working

unfortunately i observed that the stop limit order type does not work on a regular basis!?

the order is just ignored by the system

Python 3.6.2 - Missing parentheses in call to 'print'

get error using Python 3.6.2 on Win 10

command that produced error:
C:\python\BitMEX-easy-data-scripts>python fetchExecutionTradeHistory.py -h

error:

  File "fetchExecutionTradeHistory.py", line 5, in <module>
    from lib import bitmex
  File "C:\python\BitMEX-easy-data-scripts\lib\bitmex.py", line 57
    print "Instrument not found: %s." % self.symbol
                                    ^
SyntaxError: Missing parentheses in call to 'print'

1

Q

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.