bitfinexcom / bfx-hf-algo-server Goto Github PK
View Code? Open in Web Editor NEWLicense: Apache License 2.0
License: Apache License 2.0
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,
}
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
npm start
fails to start if installed latest [email protected] as dependency
workaround: downgrade bfx-hf-algo dependency to 2.1.6
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
When I try to run these projects, My machine complains about needing babel-cli however I have babel-cli (latest) installed globally.
The test
folder currently contains a stub so npm test
passes; this needs to be filled in/expanded.
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.
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
}
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.