This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
vhost: | | |
server { | |
listen __PORT____DEFAULT_VHOST__; | |
server_name __VHOST_NAME__; | |
access_log "__ACCESS_LOG__" combined; | |
error_log "__ERROR_LOG__" warn; | |
# Define the vhost to reverse proxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Http } from '@angular/http'; | |
import { Injectable } from '@angular/core'; | |
import { map } from 'rxjs/operators'; | |
@Injectable() | |
export class UsersService { | |
constructor(private http: Http) { } | |
url = 'https://randomuser.me/api/?inc=gender,name,picture,location&results=8&nat=gb/7)'; | |
getUsers() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import datetime | |
now = datetime.datetime.now() | |
minute = now.minute | |
second = now.second | |
nextstart = ((5-(minute%5))*60)-second | |
nextstart |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pip install https://github.com/matplotlib/mpl_finance/archive/master.zip | |
use with actual env pip!!! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if 'test' in bitmex.urls: | |
bitmex.urls['api'] = bitmex.urls['test'] # ←----- switch the base URL to testnet | |
print (bitmex.fetch_balance()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# THIS VERSION IS FOR PYTHON 3 # | |
#https://pythonprogramming.net/advanced-matplotlib-graphing-charting-tutorial/ | |
# | |
import urllib.request, urllib.error, urllib.parse | |
import time | |
import datetime | |
import numpy as np | |
import matplotlib.pyplot as plt | |
import matplotlib.ticker as mticker |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
Order copier | |
""" | |
# API key основного аккаунта | |
API_KEY = '69eQkHl0R0vgPod21c3XjQsT' | |
API_SECRET = 'EFAHxtJiOVYHSWa_HPtLAW50GpV31G_2GVSdm1gBZKH85Ltv' | |
# Список API ключей куда нужно транслировать ордера | |
API_KYES = ['hLlWHxkqxs42g-WeEt1_wC20'] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
////защита от потерь | |
if ((($price-$buyPrice>$limitloss) && ($position=='short'))||(($buyPrice-$price>$limitloss) && ($position=='long'))){ | |
var_dump($buyPrice); | |
var_dump($price); | |
var_dump($limitloss); | |
var_dump($position); | |
$log->emergency("$name Loss over 100 contracts"); | |
$log->warning("$name Закрываю позиции"); | |
//проверяю открытые позиции | |
$openpos=$bitmex2->getOpenPositions(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($getOrder["ordStatus"] == "New"){ | |
message("Try Edit Order"); | |
//беру цену | |
$editOrder = array(); | |
while ($editOrder != TRUE) { | |
$priceNow = array(); | |
while ($priceNow != TRUE){ | |
$priceNow=$bitmex2->getTicker("XBTUSD"); | |
usleep(1000);} | |
message("Get price OK. Price=".$priceNow); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if ($getOrder["ordStatus"] == "New"){ | |
$i=0; | |
$opos=False; | |
while (($bitmex2->cancelAllOpenOrders() !=TRUE) or $opos==True){ | |
message("Try Cancel Order"); | |
$bitmex2->cancelAllOpenOrders(); | |
usleep(505); | |
$log->warning("Try Cancel Order $name"); | |
$i++; | |
if ($i==3){ |