Giter VIP home page Giter VIP logo

bitmex-go's People

Contributors

dependabot[bot] avatar qct 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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bitmex-go's Issues

add test case

main test is too naive, add formal test case instead.

error when change BasePath to testnet

Because i want to test my strategy, when i changed the BasePath in configuration.go from "https://www.bitmex.com/api/v1" to "https://testnet.bitmex.com/api/v1", and try running testBuy function in main.go, the log printed like this:
{"error":{"message":"Signature not valid.","name":"HTTPError"}}
Please let me know how do i fix this error.
Also, there's a difference between main.go in the release ver 2.0.1 and the github lastest code, i don't know why there's difference.

"Signature not valid." Authorization fails.

Starting with fresh code, I only modify:

apiKey = "..." secretKey = "..."

and in configuration.go I change basepath line to:

BasePath: "https://testnet.bitmex.com/api/v1",

Other than that all code is unchanged.

I tested this same apikey and secretkey with bitmex official market maker sample code and they work fine.

Run testBuy() function, output is:


2018/01/15 17:17:03 -----------test buy------------
POST /api/v1//order HTTP/1.1
Host: testnet.bitmex.com
Accept: application/json
Api-Expires: 1516054628
Api-Key: [hidden]
Api-Signature: [hidden]
Content-Type: application/json
User-Agent: Swagger-Codegen/1.0.0/go

{"clOrdID":"qct_f_f_zrPpGR5cQg+3pSGtrWUVqw","ordType":"Limit","orderQty":"1","price":"9000","symbol":"XBTUSD"}
{"error":{"message":"Signature not valid.","name":"HTTPError"}}
2018/01/15 17:17:03 error:  401 Unauthorized
2018/01/15 17:17:03 result: &{%!t(string=401 Unauthorized) %!t(int=401) %!t(string=HTTP/2.0) %!t(int=2) %!t(int=0) map[%!t(string=Content-Length):[%!t(string=63)] %!t(string=Set-Cookie):[%!t(string=AWSALB=XhiLJ46tpZpXNT6qC31qWyvwFjShViyZJbXsTA8tvbLGY9PFTEDi4n1pm+qVg2etfsYbDPtRhPn0zXXdhfxgRpLdnc484rtDggzmQg9qsowyXT2sI90u1Q94xIz4; Expires=Mon, 22 Jan 2018 22:17:03 GMT; Path=/)] %!t(string=Etag):[%!t(string=W/"3f-dHGPr1ZkYjOYIJiU8wCn0/nue6I")] %!t(string=Strict-Transport-Security):[%!t(string=max-age=31536000; includeSubDomains)] %!t(string=Date):[%!t(string=Mon, 15 Jan 2018 22:17:03 GMT)] %!t(string=Content-Type):[%!t(string=application/json; charset=utf-8)]] {%!t(*http.http2clientStream=&{0xc4200efd40 0xc42000aa00 <nil> 1 0xc420337380 {{0 0} {{} 0xc420388a28 {0 0 0 <nil> <nil>} 842354166368} 0xc42010a230 0xc420010150 0xc420010b20 <nil> <nil>} true true 0x5e7680 {65426 0xc4200efda0} {4194241 0xc4200efdb0} 0 <nil> 0xc420010b00 false 0xc4203373e0 <nil> 0xc420337440 true true false map[] 0xc42043e108})} %!t(int64=63) [] false false map[] %!t(*http.Request=&{POST 0xc42007a480 HTTP/1.1 1 1 map[Api-Key:[gcx9ogiGPcINeHaHQ_lbGv4S] Api-Expires:[1516054628] Api-Signature:[f68b6941154e7999f043f24c2e92c26c60f1f7857049022f805efc9b24670817] Content-Type:[application/json] Accept:[application/json] User-Agent:[Swagger-Codegen/1.0.0/go]] {0xc42001a8c0} 0x5e26b0 110 [] false testnet.bitmex.com map[] map[] <nil> map[]   <nil> <nil> <nil> <nil>}) %!t(*tls.ConnectionState=&{771 true false 49199 h2 true  [0xc4200ec480 0xc4200ec900 0xc4200ecd80 0xc4200ed200] [[0xc4200ec480 0xc4200ec900 0xc420196d80] [0xc4200ec480 0xc4200ec900 0xc4200ecd80 0xc420316d80] [0xc4200ec480 0xc4200ec900 0xc4200ecd80 0xc4200ed200 0xc420316480]] [] [] [113 32 46 141 115 36 189 166 63 24 27 23]})}, orderId:

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.