models

package module
v0.1.43 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 16, 2025 License: BSD-2-Clause Imports: 1 Imported by: 0

README

Go-Lang API Scaffold

Scaffold project for APIs created on Bebet

Framework

  • Web : GoFiber
  • Validation : Go-Ozzo
  • Configuration : GoDotEnv
  • Log : Fiberzap
  • Swagger : swagger contrib gofiber

Architecture

Controller -> Service -> Repository

Environment required to run

  • File .env

    MONGO_URI=mongodb://mongo:mongo@localhost:27017 # replace localhost with your mongo host if you are using docker
    MONGO_DATABASE=golang
    MONGO_POOL_MIN=10
    MONGO_POOL_MAX=100
    MONGO_MAX_IDLE_TIME_SECOND=60
    
  • Docker and Docker-Compose

  • AIR (Hot reload)

    Air is a tool to hot reload your code when you save it.

    Install:

    curl -sSfL https://raw.githubusercontent.com/cosmtrek/air/master/install.sh | sh -s -- -b $(go env GOPATH)/bin
    
Running
docker-compose up -d
air

Documentation

Index

Constants

View Source
const (
	// Add book
	BookAdd byte = 'A'
	// Update book
	BookUpdate byte = 'U'
	// End of messages
	BookEnd byte = 'E'
	// Cancel book
	BookCancel byte = 'D'
	// Direction of the book in case Buy
	BookBuy byte = 'A'
	// Direction of the book in case Sell
	BookSell byte = 'V'
)
View Source
const (
	// Last Price type on Quotes.
	LastPrice byte = '2'
	// Accumulated Volume.
	Volume byte = '9'
)
View Source
const (
	// Read Latest Book
	BookReadMessage string = "GET LASTEST BOOK"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Book added in v0.1.3

type Book struct {
	Id        string  `json:"ID"`
	StockName string  `json:"StockName"`
	BookType  byte    `json:"BookType"`
	Position  uint    `json:"Position"`
	Direction byte    `json:"Direction"`
	Price     float64 `json:"Price"`
	DateTime  string  `json:"DateTime"`
	OrderId   string  `json:"OrderId"`
	Quantity  uint    `json:"Quantity"`
	OfferType byte    `json:"OfferType"`
	Average   uint64  `json:"Average"`
}

type Booking added in v0.1.25

type Booking struct {
	ID                     string          `json:"ID"`                     // Unique identifier for the signal
	Orders                 Orders          `json:"Orders"`                 // The candle that generated the signal
	Quantity               float64         `json:"Quantity"`               // The quantity of the order
	QuantityAfterComission float64         `json:"QuantityAfterComission"` // The quantity of the order after comission
	MarketDirection        MarketDirection `json:"MarketDirection"`        // The type of order
}

Quote struct for the Order.

type Bookings added in v0.1.35

type Bookings []Booking

type Bookingv2 added in v0.1.39

type Bookingv2 struct {
	ID              string          `json:"ID"`              // Unique identifier for the signal
	Trades          []Trade         `json:"Trades"`          // Details of the Trades
	MarketDirection MarketDirection `json:"MarketDirection"` // The type of order
}

type BrokerOrders added in v0.1.28

type BrokerOrders struct {
	FirstExecutedOrder  FirstExecutedOrder  `json:"FirstExecutedOrder"`  // Details of the First Executed Order
	SecondExecutedOrder SecondExecutedOrder `json:"SecondExecutedOrder"` // Details of the Second Executed Order
}

type Candle added in v0.1.1

type Candle struct {
	ID              string  `json:"ID"`
	Symbol          string  `json:"Symbol"`
	TimeStamp       string  `json:"TimeStamp"`
	Date            string  `json:"Date"`
	Current         float64 `json:"Current"`
	Open            float64 `json:"Open"`
	High            float64 `json:"High"`
	Low             float64 `json:"Low"`
	Close           float64 `json:"Close"`
	Volume          uint64  `json:"Volume"`
	VolumeVariation float64 `json:"VolumeVariation"`
}

Quote struct for quote.

type CandleV2 added in v0.1.32

type CandleV2 struct {
	Carrier propagation.MapCarrier `json:"Carrier"`
	Candle  Candle                 `json:"Candle"`
}

type ExecutedOrderSide added in v0.1.28

type ExecutedOrderSide int
const (
	EXECUTED_BUY ExecutedOrderSide = iota
	EXECUTED_SELL
)

func (ExecutedOrderSide) String added in v0.1.28

func (d ExecutedOrderSide) String() string

type ExecutedOrders added in v0.1.28

type ExecutedOrders struct {
	ID           string       `json:"ID"`           // Unique identifier for the signal
	Orders       Orders       `json:"Orders"`       // Details of the Orders
	BrokerOrders BrokerOrders `json:"BrokerOrders"` // Details of the Broker Orders
}

type FirstExecutedOrder added in v0.1.28

type FirstExecutedOrder struct {
	ID                string            `json:"ID"`            // Unique identifier for the signal
	ClientOrderId     string            `json:"ClientOrderId"` // The client order id
	TimeStamp         int64             `json:"TimeStamp"`     // The time stamp of the order
	Price             string            `json:"Price"`         // The price of the order
	OrigQty           string            `json:"OrigQty"`       // The original quantity of the order
	Status            string            `json:"Status"`        // The status of the order
	WorkingTime       int64             `json:"workingTime"`   // The time the order was placed
	Commission        string            `json:"Commission"`    // The commission of the order
	TradeId           int64             `json:"tradeId"`       // The trade id of the order
	ExecutedOrderSide ExecutedOrderSide `json:"OrderSide"`     // The side of order
}

type FirstOrder added in v0.1.25

type FirstOrder struct {
	ID        string    `json:"ID"`        // Unique identifier for the signal
	OrderSide OrderSide `json:"OrderSide"` // The side of order
	OrderType OrderType `json:"OrderType"` // The type of order
	Price     float64   `json:"Price"`     // The price of the order
}

FirstOrder struct for the First Order.

type MarketDirection added in v0.1.25

type MarketDirection int
const (
	BULLISH MarketDirection = iota
	BEARISH
)

func (MarketDirection) String added in v0.1.25

func (d MarketDirection) String() string

String returns the string representation of the SignalDirection.

type MessageType

type MessageType byte
const (
	// Quote Messages.
	QuoteType MessageType = 'T'
	// Book Messages.
	BookType MessageType = 'B'
	// News Messages.
	SynType MessageType = 'S'
)

type NewOrderRespType added in v0.1.28

type NewOrderRespType int
const (
	ACK NewOrderRespType = iota
	FULL
	RESULT
)

func (NewOrderRespType) String added in v0.1.28

func (d NewOrderRespType) String() string

type OrderSide added in v0.1.21

type OrderSide int
const (
	BUY OrderSide = iota
	SELL
)

func (OrderSide) String added in v0.1.21

func (d OrderSide) String() string

type OrderType added in v0.1.17

type OrderType int
const (
	LIMIT OrderType = iota
	MARKET
	STOP_LOSS
	STOP_LOSS_LIMIT
	TAKE_PROFIT
	TAKE_PROFIT_LIMIT
	LIMIT_MAKER
)

func (OrderType) String added in v0.1.17

func (d OrderType) String() string

type Orders added in v0.1.25

type Orders struct {
	ID       string      `json:"ID"`          // Unique identifier for the signal
	First    FirstOrder  `json:"FirstOrder"`  // Details of the First Signal
	Second   SecondOrder `json:"SecondOrder"` // Details of the Second Signal
	Strength float64     `json:"Strength"`    // 0.0 to 1.0
	Candle   Candle      `json:"Candle"`      // The candle that generated the signal
	Volume   float64     `json:"Volume"`      // The volume of the signal
}

Orders struct for the Orders.

type SecondExecutedOrder added in v0.1.28

type SecondExecutedOrder struct {
	ID                string            `json:"ID"`            // Unique identifier for the signal
	ClientOrderId     string            `json:"ClientOrderId"` // The client order id
	TimeStamp         int64             `json:"TimeStamp"`     // The time stamp of the order
	Price             string            `json:"Price"`         // The price of the order
	OrigQty           string            `json:"OrigQty"`       // The original quantity of the order
	Status            string            `json:"Status"`        // The status of the order
	WorkingTime       int64             `json:"workingTime"`   // The time the order was placed
	ExecutedOrderSide ExecutedOrderSide `json:"OrderSide"`     // The side of order
}

type SecondOrder added in v0.1.25

type SecondOrder struct {
	ID        string    `json:"ID"`        // Unique identifier for the signal
	StopGain  float64   `json:"StopGain"`  // The price target for the signal
	OrderSide OrderSide `json:"OrderSide"` // The side of order
	OrderType OrderType `json:"OrderType"` // The type of order
}

SecondOrder struct for the Second Order.

type Trade added in v0.1.41

type Trade struct {
	ID          string      `json:"ID"`          // Unique identifier for the signal
	FristOrder  FirstOrder  `json:"FirstOrder"`  // Details of the First Signal
	SecondOrder SecondOrder `json:"SecondOrder"` // Details of the Second Signal
	Quantity    float64     `json:"Quantity"`    // The quantity of the order
	Candle      Candle      `json:"Candle"`      // The candle that generated the signal
	Gain        float64     `json:"Gain"`        // The gain of the trade
}

type TypeInForce added in v0.1.28

type TypeInForce int
const (
	GTC TypeInForce = iota
)

func (TypeInForce) String added in v0.1.28

func (d TypeInForce) String() string

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL