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
Транслитерация названий страниц на PHP в ЧПУ | |
Следующая функция PHP помогает произвести транслитерацию заголовка страницы в ЧПУ с русского и казахского языков на английский язык: | |
<?php | |
function translitURL($str) | |
{ | |
$tr = array( | |
"А"=>"a","Б"=>"b","В"=>"v","Г"=>"g", | |
"Д"=>"d","Е"=>"e","Ё"=>"yo","Ж"=>"zh","З"=>"z","И"=>"i", |
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
[Unit] | |
Description=supervisord - Supervisor process control system for UNIX | |
Documentation=http://supervisord.org | |
After=network.target | |
[Service] | |
Type=forking | |
ExecStart=/bin/supervisord -c /etc/supervisord/supervisord.conf | |
ExecReload=/bin/supervisorctl reload | |
ExecStop=/bin/supervisorctl shutdown |
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
//проверяю открытые позиции | |
$openpos=$bitmex2->getOpenPositions(); | |
if ($openpos != Array()) { | |
message("You have open position. I try close it. Wait..."); | |
//если бай то закрываюсь селом | |
if ($openpos[0]["liquidationPrice"] < 1000){ | |
message("You have Buy Open Position"); | |
$orderNow = array(); | |
while ($orderNow != TRUE) | |
{point_zero1: |
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){ |
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 ((($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
""" | |
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
# 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
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
pip install https://github.com/matplotlib/mpl_finance/archive/master.zip | |
use with actual env pip!!! |
OlderNewer