In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly explains "how to access Deribit Exchange in Go language". The content in the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to access Deribit Exchange in Go language".
1. Quantification and programmed trading of digital currency options
Recently, many exchanges have opened the trading function of digital currency options as derivatives. Similar to traditional options, options trading and futures trading can combine a lot of trading strategies and trading methods. Although there are many open source quantitative trading tools on the market, these tools often need to understand the bottom of the framework, be familiar with the programming language of the framework, or manually carry out complex debugging, configuration, and modification. It is not very convenient for beginners of procedural trading and quantitative trading. A large number of trading strategies should have been focused on, and the time of trading ideas has been devoted to program debugging and programming language learning.
Inventor quantification (FMZ.COM) in the early architecture design, taking into account a variety of financial derivatives quantitative, procedural trading support, very quickly connected to the option trading. Options trading is basically similar to or even simpler than futures trading. And there is no new interface, users who are familiar with the use of FMZ will not increase other learning costs, just set the option contract as a futures contract, you can obtain the market of the option contract, issue orders, withdraw orders, query positions and other operations.
2. Access Deribit Exchange directly using native programming language
Let's take the Deribit exchange options contract as an example, for example, we want to obtain the current index price of an option contract.
Implement it in GE language:
Package main import "net/http" import "io/ioutil" import "fmt" import "encoding/json" func main () {/ / get quotes, access interface: https://www.deribit.com/api/v2/public/ticker?instrument_name=BTC-27DEC19-7250-P resp Err: = http.Get ("https://www.deribit.com/api/v2/public/ticker?instrument_name=BTC-27DEC19-7250-P") if err! = nil {panic (err)} defer resp.Body.Close () body, err: = ioutil.ReadAll (resp.Body) if err! = nil {panic (err)} ret: = string (body) fmt.Println (" this is just string data ticker: " Ret) fmt.Println ("need to be converted to JSON format") type js struct {data interface {}} ticker: = new (js) json.Unmarshal ([] byte (ret), & ticker.data) fmt.Println ("ticker:", ticker) fmt.Println ("tag price data index_price in ticker:" Ticker.data. (map [string] interface {}) ["result"]. (map [string] interface {}) ["index_price"])}
You can see that an extra pile of code has been written just to get this data.
3. Use the interface encapsulated by the inventor's quantitative trading platform
We can do it with a few simple sentences of FMZ.
Function main () {exchange.IO ("base", "https://test.deribit.com") # switch to exchange.SetContractType (" BTC-3JAN20-7250murp ") # set option contract var ticker = exchange.GetTicker () # get the data needed for printing the option quotation Log (ticker.Info.result.index_price) # Observe}
As you can see, just a few lines of code, it is very simple to get the required data.
This simply accesses the unsigned public API interface of the exchange, which is more complicated if the private interface of the signature is accessed.
Each interface also needs to do a lot of signature, parameter and other processing:
StrBody: = "" strQuery: = "" ts: = toString (time.Now (). UnixNano () / 1e6) nonce: = toString (time.Now (). UnixNano () / 1e6) uri: = resourceif httpMethod = = "GET" >
4. More complex requirements and functions
Not only that, if you need to obtain the market concurrently and asynchronously, issue an order operation, and deal with an asynchronous code base, you need to write more complex asynchronous processing logic, and an inadvertent one may cause logic design problems such as locking. If you need to use the chart display again, and then you need to learn the use of a lot of libraries, even a quantitative trader with a programming foundation will need some time to learn. However, it is much easier to use inventor quantization, because these functions have been packaged, and the designed calling interfaces are very easy to use. You can implement a variety of required functions with very little code.
Function main () {exchange.IO ("base", "https://test.deribit.com") exchange.SetContractType (" BTC-27DEC19-7250 records ") while (1) {var records = exchange.GetRecords () Log (records) $.PlotRecords (records," K ") Sleep (1000)}
Using the template library "Line drawing Class Library" provided by the platform, you can simply draw K-line charts:
Thank you for your reading. the above is the content of "how to access the Deribit Exchange with Go language". After the study of this article, I believe you have a deeper understanding of how to access the Deribit Exchange with Go language, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.