The resource loading... loading...

The Bronze Age: The Delusion of the Shinto

Author: Inventors quantify - small dreams, Created: 2016-08-25 17:30:20, Updated: 2016-08-27 16:59:06

The Bronze Age: The Delusion of the Shinto

  • Order The last time I logged on to the cloud servers, I killed them one at a time, I backed up the transaction log one at a time, and finally I deleted all the remaining files with an rm -rf command. Then I called Long, saying: F.I.A.S.C.O.

  • Oh, my God. April's Berkeley weather showed no signs of turning hot, and the students were still in their hoodies in the bar. I had just graduated and hadn't completely left school to TA a class on Stochastic Calculus. I was also staying at a small bar on Shattuck Ave with several of my fellow students at Berkeley to play table tennis and chat. Kevin was a very sexual fellow, he rarely came to class, hardly did group homework, and every time he found himself at home he was also buried in a can of beer. One thing that attracted me at the time was that Bitcoin was traded on a number of different exchanges, which were websites built by hobbyists themselves, and I thought it would be interesting to collect this price data, so I prepared to go home and write some crawler data. At the time, Bitcoin was a purely technical attraction to me, I had just finished reading the book, and I was convinced that the market is effective most of the time, and that there is not a lot of money left over, and I felt rather dim about money. A week later, he came to me to download the high-frequency data of US stocks. Since I belong to the business school, I can get the data for free. He is an interesting person, he is doing his PhD in statistics at Berkeley, but he loves trading, especially high-frequency trading. He never gets paid, he also goes everywhere to find data, every weekend in January he cleans his own data, expecting to make a sharp ratio high strategy that leads to investing in a hedge fund or self-trading company. After I copied the data that day, I talked to Vuokau about Bitcoin, and I said that the stock market is too competitive, you better look at Bitcoin, maybe it's fun, I have some Bitcoin data here, I grabbed it, you see. After a few days, I didn't remember it, but then, after a few days, I got a phone call from Vuoku, very excited, saying that it doesn't make sense, that the price difference between the exchanges is too big, why no one is taking advantage.

img

So the two of us started looking at how we could actually leverage, or move, it.

  1. Most of the exchanges have closed down due to legal issues.
  2. Bitcoin's chain of transactions (between two exchanges) takes 5 to 60 minutes (this is related to the principle of Bitcoin) and the price fluctuations during this time are enough to consume most of the profits.
  3. The biggest price difference at the time was between the US and China exchanges, but the yuan regulation, not easy to form a response ((USD-> Bitcoin-> Yuan-> USD->...)

We came up with a series of countermeasures:

  1. The fight to find an exchange that can register, when Bitcoin exchanges are in full swing, is continuing to get people registered.
  2. If the price is big enough between the exchanges, don't be afraid of these five to 60 minute fluctuations, the probability is we'll be profitable.
  3. There are a lot of ways to find a way to exchange money, and there is hope that this can be solved.

After getting acquainted, I said, let's go to a real deal and see what the problems are.

  • Oh, my God.

At the time, there was no website that could buy directly in dollars, but there were many exchanges for RMB, the largest of which was Bitcoin China (btcchina). We searched for a long time and found a site called Local BTC, probably the idea is that you can reserve Bitcoin, and then after a potential transaction is formed, the site helps you freeze a part of the bitcoin from the seller, and when you transfer it, the part of the bitcoin goes to you.

To make a comparison, we picked an Egyptian seller to start our first order. Two of them were very busy at the time, especially afraid of being scammed, so we arranged for one to stay at home with the seller via Skype, ignore the seller, and one to run to the bank to transfer the money. So I ran to the bank to transfer the money to the seller.

img

In the first transaction we bought 0.94 bitcoins, a number I will never forget. When I called the bank and told the bank that the payment had been made, there was an instant sensation of a foreign exchange trader selling the pound under the sky bridge.

The first order was finally 30% off, which made me happy to get a chinese fork. At the time, we were trying to figure out where in the US we could buy a lot of bitcoins. Local BTC had too few retailers on it, and several of the largest exchanges in the US, such as Mt. Gox, were closed. At that time, we found out that the Canadian exchange Virt Ex was possible to register, but to register a company, so we contacted a Canadian friend to take care of the registration company.

While we were preparing to open a company in Toronto, we found that domestic Bitcoin players were already frantically squeezing out the existing profit margin. At the time, the price gap between the two countries was maintained at 30%-50% for a long time, so many domestic Bitcoin players with U.S. exchange accounts bought a lot of Bitcoin, and after selling in China, Taobao exchanged the U.S. dollar at an 8:1 exchange rate (at that time the exchange rate was already 6.2X), continuing the arbitrage, and the price of the two sides will not decrease rapidly.

  • Oh, my God.

By this time, my reptile had collected almost a month's worth of data, and after a careful analysis, it was found that there is often a significant price difference between several RMB exchanges: BTC China, Token Net, Okcoin, and all three are convenient.

So you buy directly on the low exchange and then transfer directly to the higher exchange and sell it? It looks simple, but still you need to bear that 5-60 minute transfer price fluctuation because you don't have the hedge.

In the meantime, a new strategy has been devised by the Fukuoka, and one example of this is:

You start out with an apple in your left hand and it's $10 each, and then the price of the apple on both sides is $10 each.

img

And then the price of the apple on the left hand changes, and the apple on the left hand becomes $8 and the apple on the right becomes $12.

img

You think the price fluctuation is big enough. You can buy apples with your left hand and sell apples with your right hand. So you have two apples in your left hand, $2 cash, no apples in your right hand, $2 cash.

img

You must have the number of apples, but you have $4 more in cash.

So how do you continue to trade, let's say the left-hand price relationship is reversed, say the left hand becomes $11 and the right hand becomes $10. The left hand sells one of the two apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys one of the apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys one of the apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys one of the apples, and the right hand buys one of the apples, and the left hand buys the apples.

img

Now Apple's distribution is back to zero, but you've got $5 more cash, so you can keep moving around like this.

So what about the change in the value of these two apples? Although we still have two apples, Apple may have devalued.

img

As long as we break down a certain number of bitcoins, then we can do this transaction without risk, because the value of Apple itself is irrelevant.

But the core problem is that sometimes the price of two exchanges does not really reverse, for example BTC China is higher than the price of the tokens network in the long term, what happens? What happens when you calculate the average of the price difference on both sides, when the price difference is greater than the average, move the apple to the side, when the price difference is less than the average, move back.

img

Assuming that the two exchanges have a spread of 100 but a stable wobble near this mean, you can make a corresponding positive inverse move away from the outliers. This may be a loss from a single trade perspective, but a statistically significant gain from a single trade cycle.

  • What is it?

At this point, the transaction is no longer a pure arbitrage, but a statistical arbitrage. The price difference between the two markets is stable near a level, and the volatility of the difference is stable. From a mathematical point of view, the prices of the two exchanges (P1 and P2) correspond to the following relationship:

img

After determining how to do this, I started implementing this cross-exchange trading system.

img

In simple terms, the system consists of four components, mainly written in Python, with a fully Web-based GUI and a back-end database called redis+mongodb:

- Optimus:擎天柱大哥,看盘终端,GUI
- Nirvana:涅槃,数据抓取系统——比特币网站的接口那个烂,经常crash,用涅槃寄寓我们希望稳定抓数据的心愿
- Einstein:主程序,做主要的算法交易逻辑
- Achilles:阿基里斯,下单系统

Achilles was the most interesting, since many Bitcoin trading sites did not have an API at the time, so the only way to order was to inject Javascript, in other words, a robot, simulated person logged on to the site, simulated person pointed the mouse.

Of course, using Node.js to wrap V8 directly is also a very dark technology.

The system took me three weeks to develop, and the code I wrote alone, which I never had the chance to practice in school before, still had a lot of problems. The biggest problem at the time was that each move required two exchanges to synchronize orders, but the number of transactions on both sides could be different, so we had to follow up. We proposed two solutions:

- 线性下单,先下单价格变化快的交易所,得到成交数量了,再下单变化慢的交易所
- 追单,同步发单,然后每次逻辑循环检查整个系统的风险敞口,如果不为零就在单边补单——如果要买比特币就去低价交易所,要卖比特币就去高价交易所

This year, the domestic classified fund suites are very hot, and I think there are similar problems, while ordering A, B funds, how to operate technically, the simplest is to buy B first, because B moves relatively quickly, and then buy A according to the number of transactions.

Miscellaneous for geeks:

  • After starting trading, one morning, I was going to check the earnings last night, and found out that the automatic re-login system was blocked by the token network. Our system will automatically log out every 20 minutes to prevent the next order session.http://m.huobi.comI had to go to the mobile client and log out, get the session, and then go back to the desktop to order. That morning was a wonderful moment.

  • Previously, our program was running on my local server, and the latency was around 300ms, so we tested a lot of cloud services like Ali Cloud, Big Cloud, and finally we found Big Cloud Ping, their server had the lowest latency, around 10ms, so we all switched to Big Cloud, and the co-location was done.

  • Whoa.

Since all the exchanges are in the country, and I and Wukong have also been out of the country for a while, I couldn't handle the transfers myself, so I found a small Pyongyang company. Longda owns a P.E. and V.C. company in the country (if there is a friend interested in financing, Huang: Wencom Capital), very grounded, indeed, a good choice for domestic operations. After listening to my very excited rant, Longda, although he did not fully understand our strategy, was very reliably prepared.

When everything was ready, we started trading, of course, with a lot of detail issues, both strategic and systemic, which required omitting the tens of thousands of words of the process of debriefing.

img

Although it looks scary, the profit per trade is very small, and the capacity of such a leverage is very limited, so it's a little bit boring to feel like you're not making any money. But after the last month, we basically don't have to worry, why, why, it's okay to get up in the morning and collect little money.

And then gradually the PnL check got higher.

img

It operated until February 2014, when a major event occurred in the Bitcoin community when Mt. Gox, a Japan-based exchange, collapsed, causing massive volatility in Bitcoin prices worldwide.

结果那段时间成了我们盈利能力最强的时间,因为各个交易所之间价格经常脱钩100元以上,单次套利的利润空间变得非常大。当然最万幸的是,我们没有在Mt.Gox交易,不然也是血本无归了。

img

The ending

After running for almost eight months, my company and I finally decided to shut down the system; at the time, there were three main reasons:

  • After Mt. Gox collapsed, confidence in Bitcoin declined, and trading volumes began to plummet after the peak.
  • Both I and Vuong Ho slowly started working full-time and should no longer be doing my own business outside.
  • Rumor has it that the central bank will restrict access to domestic Bitcoin exchanges, making funds increasingly insecure. But these eight months have left me with a lot of enlightenment, and have also made me and Hokusai good friends, talking about the market often together. When we finally summed it up together, we found that our strategy and trading system had an annualized return of 280%, while the Sharpe Ratio was around 11%.

I never believed there was a strategy with a Sharpe Ratio of more than 5, but I realized that there really is a Sharpe Ratio of more than 10 which basically means that your strategy has no days of losses throughout the year, and the difference comes entirely from the difference in how much profit you make every day.

Later, I started doing automated trading in the US interest rate markets myself, and I met a growing number of friends who were betting on a variety of odd assets, including Diablo, online poker, and discovered an interesting pattern:

准入门槛(资金上、技术上、政策上)越高的东西,策略越简单,而门槛越低的东西,策略越复杂

Interest rates in the United States, domestic stock index futures, are not high entry threshold assets, so the design and adjustment of trading strategies is relatively complex, while Bitcoin, Diablo game props, because it takes a lot of effort to build a decent trading system, the necessary strategies are not complex.

Therefore, a team of brokers or traders needs to be able to accurately estimate the ability to invest in the output. Assuming their technical strength is strong, but their strategic ability is weak, they can intervene more in a strange market such as Bitcoin, using the technical strength to offset the inefficiencies between the markets; if the strategic strength is strong, they can do low-frequency common assets; if the technology and strategic strength are very strong, they can try high-frequency Alpha trading of various active assets.

A year later (in 2015), the big boss MD arranged for me to take my Harvard CSE students to do an Industry Project (Course 297r), where I was asked to write a book on the subject.Applied Computation 297r. Computational Science and Engineering Capstone ProjectI remembered this experience with Bitcoin, so I took the previous data and gave it to them to study Bitcoin trading strategies. In addition to the Pairs Trading strategy we did, they also studied Hidden Markov Chain and other technical indicator trading methods.

https://www.dropbox.com/s/zcbph5labk0u3pg/297_Report.pdf?dl=0

New York in the summer of 2015

Link to original


More