Sistema de trading OCOX para Bitfinex

Hola,

He escrito un pequeño programa en Golang para aplicar un sistema de trading rentable en el corto plazo ya que las cirptomonedas son volátiles.

Este sistema solo se puede aplicar en Bitfinex, y con margen. El sistema consiste un usar la opción OCO en las ordenes Limit. Este programa te calcula el gap en el precio para abrir la operación y el precio a poner según el porcentaje al que quieras tomar beneficios.


OCOX.png

Cuando se aplica la opción OCO a una orden Limit se le esta añadiendo un Stop a la orden Limit. Si una de las dos se activa cancela a la otra. Esto se suele usar para cuando tienes abierta una orden, añadirle un Stop Loss y una Take Profit. Estando seguro que solo una de las dos se ejecutara, ya que cancelara la otra al ejecutarse.

Si añadimos dos ordenes tipo Limit OCO, tenemos cuatro ordenes, cubriendo que el precio pueda subir o bajar.
Si el precio sube por ejemplo, se activara la orden Stop Buy, esta cancelara la orden Limit Buy y cuando el precio toque la orden Limit Sell se cerrara la orden Stop Sell y se vendera lo comprado recogiendo beneficios.

Siempre se le pone un % de gap de distancia para las ordenes Stop, y el margen de ganancia se añade a partir de las ordenes Stop. La perdidas maximas son la distancia entre el Stop y el Limit de la misma orden. Esto creo que lo he calculado mal ahora que lo veo. Pero te puedes hacer una idea.

package main

import (
    "fmt"
)

func main() {

    var price float32
    var priceGapPercent float32
    var profitPercent float32

    fmt.Printf("//////////////////////////////////\n")
    fmt.Printf("  BITFINEX OCO STRATEGY - OCO 2X\n")
    fmt.Printf("//////////////////////////////////\n\n")

    //INPUTS
    fmt.Print("Precio actual de la moneda: ")
    _, err := fmt.Scanf("%f", &price)

    if err != nil {
        fmt.Println(err)
    }

    fmt.Print("Gap para apertura de ordenes %: ")
    _, err2 := fmt.Scanf("%f", &priceGapPercent)

    if err2 != nil {
        fmt.Println(err)
    }

    fmt.Print("Profit %: ")
    _, err3 := fmt.Scanf("%f", &profitPercent)

    if err3 != nil {
        fmt.Println(err)
    }


    marginStop := price * (priceGapPercent * 0.01)

    ocoBuyStop := price + marginStop
    ocoSellStop := price - marginStop


    marginLimit := price * (profitPercent * 0.01)

    ocoBuyLimit := price - marginStop - marginLimit
    ocoSellLimit := price + marginStop + marginLimit

    maxLoss := ((priceGapPercent * 2) * price) / 100

    fmt.Printf("\nBUY - Limit: %f  Stop: %f\n", ocoBuyLimit, ocoBuyStop )
    fmt.Printf("SELL - Limit: %f  Stop: %f\n", ocoSellLimit, ocoSellStop )
    fmt.Printf("\nMax Loss: %f $-€-btc \n", maxLoss)
}

Sort:  

Congratulations @bitcoinator! You received a personal award!

DrugWars Early Access
Thank you for taking part in the early access of Drugwars.

You can view your badges on your Steem Board and compare to others on the Steem Ranking

Do not miss the last post from @steemitboard:

Are you a DrugWars early adopter? Benvenuto in famiglia!

You can upvote this notification to help all Steem users. Learn how here!


@bitcoinator, sorry to see you have less Steem Power.
Your level lowered and you are now a Red Fish!

You can upvote this notification to help all Steem users. Learn how here!

Congratulations @bitcoinator! You received a personal award!

Happy Birthday! - You are on the Steem blockchain for 1 year!

You can view your badges on your Steem Board and compare to others on the Steem Ranking

You can upvote this notification to help all Steem users. Learn how here!

Coin Marketplace

STEEM 0.24
TRX 0.11
JST 0.031
BTC 61875.79
ETH 3013.13
USDT 1.00
SBD 3.69