GithubHelp home page GithubHelp logo

bfx-hf-algo-server's People

Contributors

f3rno avatar jacobplaster avatar prdn avatar robertkowalski avatar tarcisiozf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bfx-hf-algo-server's Issues

Refactor/Feature: Rename/Add Commands

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

Currently the server supports the following commands:

const cmdMap = {
  'get.aos': getAllAOs,
  'submit.ao': submitAO,
  'stop.ao': stopAO,
}

I propose we change this to:

const cmdMap = {
  'ao.status': getAOStatus,
  'ao.get.all': getAllAOs,
  'ao.get': getAOByID,
  'ao.start': startAO,
  'ao.stop': stopAO,
}

bfx:hf:algo:ao-host failed to register AO UIs: 500 - ["error",10100,"perm: invalid"] +0ms

I have this error when starting the server

  bfx:hf:host:register-ao-uis registering UI bfx.ping_pong +0ms
  bfx:hf:host:register-ao-uis registering UI bfx.iceberg +2ms
  bfx:hf:host:register-ao-uis registering UI bfx.twap +1ms
  bfx:hf:host:register-ao-uis registering UI bfx.accumulate_distribute +1ms
  bfx:hf:algo:ao-host failed to register AO UIs: 500 - ["error",10100,"perm: invalid"] +0ms

there was some unmet peer dependencies upon npm install that I had to install manually.
I am not proficient in nodejs but the install seems ok, I am stuck figuring out the source of this error

not compatible with latest bfx-hf-algo 2.1.7

Issue type

  • bug

Brief description

npm start fails to start if installed latest [email protected] as dependency

workaround: downgrade bfx-hf-algo dependency to 2.1.6

Steps to reproduce

  • installing by instructions on fresh Ubuntu 20.04
Additional Notes:
  • stack trace
    obrazek

  • there seems to be new way to initialize AOHost in bfx-hf-algo since 2.1.7
    obrazek

Problem with Ping/Pong order

Hello, using latest bfx-hf-algo-server, when trying to place ping/pong an error occurs.
On web side: "HF client response timed out".
On nodejs side:

stackman loading source map for /opt/bitfinex/bfx-hf-algo-server/node_modules/p-iteration/lib/static-methods.js +1ms
! onSubmit -> AlgoServer (/opt/bitfinex/bfx-hf-algo-server/lib/server.js) [283:%s]
! onWSNotification -> AlgoServer (/opt/bitfinex/bfx-hf-algo-server/lib/server.js) [208:%s]
! Object.<anonymous> -> Object (/opt/bitfinex/bfx-hf-algo-server/node_modules/bfx-hf-algo/lib/async_event_emitter.js) [132:%s
]
! exports.forEachSeries -> Object (/opt/bitfinex/bfx-hf-algo-server/node_modules/p-iteration/lib/static-methods.js) [34:%s]
! emit -> AOHost (/opt/bitfinex/bfx-hf-algo-server/node_modules/bfx-hf-algo/lib/async_event_emitter.js) [127:%s]

source from /opt/bitfinex/bfx-hf-algo-server/lib/server.js:283
  */
 async onSubmit (id, mid, type, payload) {
   const ao = this.host.getAO(id)

   if (!ao) {
!!!
     return this.onError(new Error(`submit requested for unknown AO: ${id}`))
!!!
   }

   const { meta = {} } = ao
   const { validateParams, processParams } = meta
 bfx:api:ws2:send send: [0,"n",null,{"mid":1599907951255,"type":"ucm-hb","info":{}}] +3s

error upon npm start

Issue type

  • bug
  • missing functionality
  • performance
  • feature request

Brief description

Get this error when following the guide installation steps...

error message

Steps to reproduce

Additional Notes:

Feature: Add Tests

The test folder currently contains a stub so npm test passes; this needs to be filled in/expanded.

bfx:hf:algo:ao-host failed to register AO UIs: 502 / 404

Hello,
i try the server and it come to errors, when i use endpoint https://api-pub.bitfinex.com/v2/ i become the error bfx:hf:algo:ao-host failed to register AO UIs: 502

When i try it with endpoint https://api.bitfinex.com/v2/ the error is bfx:hf:algo:ao-host failed to register AO UIs: 404 .

After this error the websocket register successful and in the bitifinex UI under "Orders" the status "HF Connected" appears but the trading strategys are not shown in the UI.

Algo server active notification breaks golangLib

When the algo server is active a notification is broadcasted which does not correctly fit the schema of the bitfinex api notification. This causes for go (which expects an exact type schema) to break:

Incoming: [1.559795887973e+12 ucm-hb 1.559795890329e+12 <nil> map[] <nil> <nil> <nil>]

panic: interface conversion: interface {} is map[string]interface {}, not []interface {}

goroutine 59 [running]:
github.com/bitfinexcom/bitfinex-api-go/v2.NewNotificationFromRaw(0xc0003c6000, 0x8, 0x8, 0xc0000ba2a0, 0x194, 0x0)
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/types.go:1257 +0xab1
github.com/bitfinexcom/bitfinex-api-go/v2/websocket.(*Client).convertRaw(0xc0001320e0, 0xc5c34e, 0x1, 0xc0003c6000, 0x8, 0x8, 0xc000329d50, 0x42ce81)
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/websocket/channels.go:347 +0x398
github.com/bitfinexcom/bitfinex-api-go/v2/websocket.(*Client).handlePrivateDataMessage(0xc0001320e0, 0xc5c34e, 0x1, 0xc0003c6000, 0x8, 0x8, 0x7d74b8, 0xc0000c2e10, 0x1c60271f89, 0xc946c0)
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/websocket/channels.go:222 +0x7b
github.com/bitfinexcom/bitfinex-api-go/v2/websocket.(*Client).handlePrivateChannel(0xc0001320e0, 0xc0000ba280, 0x3, 0x4, 0x0, 0x0)
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/websocket/channels.go:147 +0x25a
github.com/bitfinexcom/bitfinex-api-go/v2/websocket.(*Client).handleChannel(0xc0001320e0, 0xc00047d200, 0x45, 0x600, 0x1, 0x1)
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/websocket/channels.go:53 +0x514
github.com/bitfinexcom/bitfinex-api-go/v2/websocket.(*Client).handleMessage(0xc0001320e0, 0xc00047d200, 0x45, 0x600, 0x1, 0x0)
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/websocket/client.go:447 +0x26e
github.com/bitfinexcom/bitfinex-api-go/v2/websocket.(*Client).listenUpstream(0xc0001320e0, 0x98ef40, 0xc0000c2eb0)
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/websocket/client.go:369 +0x14c
created by github.com/bitfinexcom/bitfinex-api-go/v2/websocket.(*Client).reset
        /mnt/c/Users/jacob/Documents/go/pkg/mod/github.com/bitfinexcom/[email protected]/v2/websocket/client.go:307 +0xcb

Goland notification parsing function:

func NewNotificationFromRaw(raw []interface{}) (o *Notification, err error) {
	fmt.Println(raw)
	if len(raw) < 8 {
		return o, fmt.Errorf("data slice too short for notification: %#v", raw)
	}

	o = &Notification{
		MTS:       i64ValOrZero(raw[0]),
		Type:      sValOrEmpty(raw[1]),
		MessageID: i64ValOrZero(raw[2]),
		//NotifyInfo: raw[4],
		Code:   i64ValOrZero(raw[5]),
		Status: sValOrEmpty(raw[6]),
		Text:   sValOrEmpty(raw[7]),
	}

	// raw[4] = notify info
	var nraw []interface{}
	if raw[4] != nil {
		nraw = raw[4].([]interface{})
		switch o.Type {
		case "on-req":
			on, err := NewOrderFromRaw(nraw)
			if err != nil {
				return o, err
			}
			orderNew := OrderNew(*on)
			o.NotifyInfo = &orderNew
		case "oc-req":
			oc, err := NewOrderFromRaw(nraw)
			if err != nil {
				return o, err
			}
			orderCancel := OrderCancel(*oc)
			o.NotifyInfo = &orderCancel
		case "fon-req":
			fon, err := NewOfferFromRaw(nraw)
			if err != nil {
				return o, err
			}
			fundingOffer := FundingOfferNew(*fon)
			o.NotifyInfo = &fundingOffer
		case "foc-req":
			foc, err := NewOfferFromRaw(nraw)
			if err != nil {
				return o, err
			}
			fundingOffer := FundingOfferCancel(*foc)
			o.NotifyInfo = &fundingOffer
		case "uca":
			o.NotifyInfo = raw[4]
		}
	}

	return
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.