-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.py
More file actions
executable file
·54 lines (37 loc) · 1.7 KB
/
test.py
File metadata and controls
executable file
·54 lines (37 loc) · 1.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) Dave Beusing <david.beusing@gmail.com>
#
#
import datetime as dt
from binance import Client
from utils import Credentials, applyIndicators, fetch_OHLCV
from models import Asset
credentials = Credentials( 'key/binance.key' )
client = Client( credentials.key, credentials.secret )
client.timestamp_offset = -2000 #binance.exceptions.BinanceAPIException: APIError(code=-1021): Timestamp for this request was 1000ms ahead of the server's time.
#asset = Asset( client, 'LRCUSDT' )
#start = str( int( dt.datetime.timestamp( dt.datetime.now() - dt.timedelta(minutes=60) ) ) )
#start = str( int( ( dt.datetime.now() - dt.timedelta(minutes=60) ).timestamp() ) )
#df = fetch_OHLCV( client, asset.symbol, interval='1m', start_date='60 minutes ago UTC' )
#applyIndicators( df )
#print( f'{df.ROC.iloc[-1]} {df.ROC.iloc[-1:]}' )
#print(df)
#https://stackoverflow.com/a/7224186
#https://stackoverflow.com/a/51950538
#https://docs.python.org/3/library/subprocess.html#module-subprocess
#import subprocess
#proc = subprocess.Popen(["rm","-r","some.file"])
#proc = subprocess.Popen( [ 'python', '/home/dave/code/crypto/bot/CryptoPro.py' ], close_fds=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT )
#with open( '/home/dave/code/crypto/bot/log/stdout.log', 'a+' ) as logfile:
# proc = subprocess.Popen( [ 'python', '/home/dave/code/crypto/bot/CryptoPro.py' ], close_fds=True, stdout=logfile, stderr=subprocess.STDOUT )
#print( proc.pid )
#proc.terminate()
# oder
#import os
#import signal
#os.kill(proc.pid, signal.SIGTERM) #or signal.SIGKILL
start = '2021-11-24 18:53:21.726234'
end = '2021-11-24 21:53:45.679110'
#runtime = dt.datetime.fromisoformat( start )