In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-03-29 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)05/31 Report--
This article mainly introduces the relevant knowledge of "how to realize the cross-currency hedging strategy of blockchain". Xiao Bian shows you the operation process through actual cases. The operation method is simple, fast and practical. I hope this article "how to realize the cross-currency hedging strategy of blockchain" can help you solve the problem.
Among hedging strategies, there are various types of hedging. Cross-market hedging, cross-period hedging, etc. Today we're going to talk about cross-variety hedging, specifically cross-currency hedging strategies in blockchain asset quantitative trading. A typical hedge involves buying or selling different subjects, whereas the subjects are the same. When hedging the same instrument, we can use the price difference as the buying and selling price in hedging transactions. In the simplest case of cross-market hedging, this price difference is repeatedly oscillating within a certain range. Cross-breed hedging certainly cannot use the price difference as the buying and selling price, because the price difference between different breeds is not very intuitive to observe, usually using the price ratio as the buying and selling price.
For example:
A trading pair is: LTC_USDT
B trading pair is: ETH_USDT
Spread open positions based on the price ratio of pair A/pair B. The larger this ratio, the more we have to sell A and buy B. If the ratio decreases, buy A and sell B. Each time the USDT amount is equal, it is actually a strategy to trade grid with the relative price strength of LTC/ETH. The strategy idea is not complicated. However, it should be noted that this hedging combination is actually priced at LTC with ETH as the anchor price currency. This anchor price is likely to move out of a one-sided trend, although most of the time it may be a volatile trend, but this risk needs to be considered and noted.
Using the inventor's quantitative trading platform, it is easy to write strategy prototypes:
When policy code runs, references and
"Draw Line Library"
"Digital currency spot trading library": This is the template bar that comes with each user's new strategy.
/*backteststart: 2019-05-01 00:00:00end: 2019-11-04 00:00:00period: 1mexchanges: [{"eid":"OKEX","currency":"LTC_USDT","balance":100000,"stocks":30},{"eid":"OKEX","currency":"ETH_USDT","balance":100000,"stocks":30}]*//*A exchanges[0] : EOS_USDT B exchanges[1] : ETH_USDT*/var Interval = 500//Parameters var numPoint = 100 //var distance = 0.08 //proportional spacing var amountPoint = 100 //Node Amount, Unit USDTvar arrHedgeList = []function main () { var isFirst = true while(true) { var rA = exchanges[0].Go("GetTicker") var rB = exchanges[1].Go("GetTicker") var tickerA = rA.wait() var tickerB = rB.wait() if (tickerA && tickerB) { var priceRatioSell = tickerB.Buy / tickerA.Sell // B sell , A buy var priceRatioBuy = tickerB.Sell / tickerA.Buy // B buy , A sell if (isFirst) { for (var i = 0 ; i
< numPoint ; i++) { var point = { priceRatio : priceRatioSell + (i + 1) * distance, coverRatio : priceRatioSell + i * distance, amount : (0.08 * i + 1) * amountPoint, isHold : false, } arrHedgeList.push(point) } isFirst = false } for (var j = 0 ; j < arrHedgeList.length; j++) { if (priceRatioSell >arrHedgeList[j].priceRatio && arrHedgeList[j].isHold == false) { // B sell , A buy Log("hedge, priceRatioSell, "#FF0000") $.Buy(exchanges[0], arrHedgeList[j].amount / tickerA.Sell) $.Sell(exchanges[1], arrHedgeList[j].amount / tickerB.Buy) arrHedgeList[j].isHold = true LogStatus(_D(), exchanges[0].GetAccount(), "\n", exchanges[1].GetAccount()) $.PlotLine("ratio", (priceRatioSell + priceRatioBuy) / 2) break } if (priceRatioBuy
< arrHedgeList[j].coverRatio && arrHedgeList[j].isHold == true) { // B buy , A sell Log("对冲,价格比", priceRatioBuy, "#32CD32") $.Sell(exchanges[0], arrHedgeList[j].amount / tickerA.Buy) $.Buy(exchanges[1], arrHedgeList[j].amount / tickerB.Sell) arrHedgeList[j].isHold = false LogStatus(_D(), exchanges[0].GetAccount(), "\n", exchanges[1].GetAccount()) $.PlotLine("ratio", (priceRatioSell + priceRatioBuy) / 2) break } } } Sleep(Interval) }}可以通过回测,来最初步的验证一下策略思路 使用默认的回测设置:It can be seen that only a few dozen lines of code have been used to construct a strategy of their own ideas. It is very easy to implement a prototype of an idea on the inventor's quantitative trading platform. From the above chart, this price ratio is oscillating most of the time, but there will be a certain trend trend. The optimization direction can be position control for hedging or add certain trend identification.
In terms of position control, you can increase the hedging amount of each hedging node. For example, in the code:
if (isFirst) { for (var i = 0 ; i
< numPoint ; i++) { var point = { priceRatio : priceRatioSell + (i + 1) * distance, coverRatio : priceRatioSell + i * distance, amount : (0.08 * i + 1) * amountPoint, // 每次递增amountPoint的8% isHold : false, } arrHedgeList.push(point) } isFirst = false} 这样可以让相对较重一点的仓位集中在价格比例较高的位置,避免价格比例较低时,占用仓位偏****r />Of course, such cross-breed hedging is very risky. If the price of one coin continues to rise relative to another coin, it will cause floating losses, so cross-breed hedging requires strong correlation between the two varieties.
The content of "How to realize cross-currency hedging strategy of blockchain" is introduced here. Thank you for reading. If you want to know more about industry-related knowledge, you can pay attention to the industry information channel. Xiaobian will update different knowledge points for you every day.
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.