vendredi 16 décembre 2022

How to send an OCO Order to Binance in Python ?

 #Open_position_order function on Binance

def open_position_order(symbol,quantity, side, order_type = ORDER_TYPE_MARKET):

    try:
        print("sending order")
        order = client.create_order(
        symbol=symbol,
        side=side,
        type=order_type,
        quantity=quantity)
   
        print(order)
       
    except Exception as e:
        print('open position order error')
        return False
   
    return True


You might need to install the following dependency :
pip install python-binance

jeudi 15 décembre 2022

Exemple pyinstaller

 pyinstaller.exe --onefile MyPythonScript.py

The Windows executable file will then be created in the "dist" directory.

mercredi 14 septembre 2022

What about mining NERVA ?

 I was surfing Twitter and found out that a new cryptocurrency was mined : NERVA.

NERVA seems to be a fork of Monero (XMR).

As I'm already mining XMR, I'll try to mine NERVA also.

Here are the websites that could help you starting to mine NERVA :

https://nerva.one/#mining

https://www.cryptunit.com/miner/NERVA-Miner

Happy mining !

Coding a strategy with PineScript v5

 Here are the very basics that will help you get started with coding a strategy in PineScript v5 (The programming language on Tradingview) :


//@version=5

strategy("test", initial_capital=500)

if open>close[1]

    strategy.entry("Long", strategy.long, 1000)

    //strategy.entry("sell", strategy.short, 1)

    strategy.exit("Exit", "Long", profit = 100, loss = 100)

plot(strategy.equity)


For those who are interested of the details of this very simple strategy : It checks if the current close price is greater than the previous open price and in that case it buy a quantity of 1000 and will sell when the price is 100 points higher.

Eg. on CHZUSDT in 15-minutes timeframe, it could open the following trade :






vendredi 26 août 2022

How to install TA-Lib on Ubuntu (and on GitPod.io...) ?

Here is the link to the documentation that helped me a lot, and thanks to it TA-Lib was installed in less than 5 minutes (I was installing FreqTrade and an error about the ta-lib installation were shown) :

https://blog.quantinsti.com/install-ta-lib-python/

Here I write the lines that helped me (in case the link above were suppressed) :


sudo apt-get -y install gcc build-essential


wget -O inst_conda.sh "https://repo.anaconda.com/archive/Anaconda3-2020.11-Linux-x86_64.sh" \

  && /bin/bash inst_conda.sh -b \

  && rm inst_conda.sh \

  && ./anaconda3/bin/conda init \

  && source ~/.bashrc \

  && conda create -n quantra python=3.6.8 -y \

  && conda activate quantra


wget http://prdownloads.sourceforge.net/ta-lib/ta-lib-0.4.0-src.tar.gz \

  && sudo tar -xzf ta-lib-0.4.0-src.tar.gz \

  && sudo rm ta-lib-0.4.0-src.tar.gz \

  && cd ta-lib/ \

  && sudo ./configure --prefix=/usr \

  && sudo make \

  && sudo make install \

  && cd ~ \

  && sudo rm -rf ta-lib/ \

  && pip install ta-lib