Is anyone doing anything interesting with cryptocurrency?

the_technocratthe_technocrat IC-MotY1Indy Icrontian
edited April 2018 in Science & Tech

I've casually looked for an excuse to learn a little Python before, but never acted on it - until I saw a pretty well-done tutorial.

It was for a trading bot, and I remembered I had a bitcoin account somewhere - I think I put in $60 a while back, and it was like $350? Nice! I did the tutorial but then was too scared to try it with my newfound vast crypto fortune. /s

I've been poking around different parts for a bit, shortlist:

  1. Bought into an ASIC preorder, then multiple companies beat them to market. So we'll see how that works out in June. Would be a fail...but the manufacturers have some sort of relationship with the Sia coin devs... and Sia coin devs threatened to fork Sia...just to brick everyone else's ASIC but the one their friends made / discussed with Sia before starting to build the first ASIC on the coin. If that happens, then it'll be great for me. If not, lesson learned, but that 400-day ROI will sting.

  2. I've been using Gekko, and loading it with strategies I find on github for backtesting, just to see how people think about trading, and maybe learn why they do the things they do. I found a side program that will do genetic-algo and run the simulations over and over again, I've been letting the program "evolve" 2 simple strategies I like / can understand, changing the variables just a little each time. Testing against USDT-BTC since Jan 1 seems like a decent mix of situations, and they look pretty good! Too afraid to let Gekko trade with my real money yet, though...I only have $350 to play with :)

  3. Some of the strategies people make use neural nets and other really complex stuff! Most do terrible, but I haven't tested them beyond the default setting. These complex strategies run slowly and make gekkoga time out. I found a js package that can offload batch calculations to the GPU, but I don't know js well enough to use it

  4. Found a decent podcast I can fit into my commute (if I play it at 1.25x speed, which is a little strange sometimes). He goes through some basic and moderately complex stuff around Technical Analysis, but he does it in a nice way.

How 'bout you? Anybody know what they're doing around here / have anything interesting happen in the space?

«1

Comments

  • ThraxThrax 🐌 Austin, TX Icrontian

    Ping @Myrmidon

  • MyrmidonMyrmidon Baron von Puttenham California Icrontian

    You've got me beat on literally all accounts. I trade a couple cryptos back and forth merely for fun, but I do it all manually instead of with a bot, and I'm not on the bleeding edge at all. No algorithms, just playing with spreadsheets. Keep posting the shit you find here, because that's really cool stuff.

    I will tell you that it's very freeing to just let go of that $350. Consider the $60 spent on 'entertainment' that bought you $350 of funny-money, and go play... don't treat it like a payday, treat it like a video game.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    Oh, I will - I just want to make sure I complete the "tutorial stage" first in the "game".

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    One result from the GA testing, for example:

    TEMA strategy: 25 Dec 2017 to 26 Apr 2018
    Trade pair: USDT-BTC
    Population: 10 per epoch
    Mutation per epoch: random-generate 40% new individuals in each epoch (attempts to take over top 60% who are currently fine-tuning as 'genetically superior'
    Epochs: 2500 (this is how many "generations" of populations have evolved in the sim)

    The end result is that around 25,000 combinations of settings have been backtested in a 3-setting strategy on ~4 months of trading history.

    Optimal settings found in simulation:

    Candlesize: 30
    History size: 15 (how many candles to consider as 'history' to guide decisions on candle #1-15)
    Candles to use for short TEMA indicator: 26
    Candles to use for long TEMA indicator: 184
    Candles to use for long SMA indicator: 387`

    If these settings had been used for the test period:

    Starting balance: $13,650
    Ending Balance: $22,510
    Trades: 36
    Trade Fee: 2.5%
    Strategy Performance: +64.91%
    Market Performance: -28.63%`

    Note: all this means is that this strategy would have done well during these 4 months. Past performance does not guarantee similar performance in the future.

    However... to me, I think similar market conditions may yield similar results... and I'm intentionally trying to include a wide array of conditions in the test period to see if any strategy combinations can fare well in most market conditions.

    What I'm finding is that the answer is 'no': some strategies can be optimized for bear markets, and some for bull markets, but not both. But... there are indicators out there to flag when the market is changing back and forth...and I'm trying to figure out how to have it run different optimizations of the same or different strategies tailored to either of those conditions.

    TEMA trading history with the above settings:

  • primesuspectprimesuspect Beepin n' Boopin Detroit, MI Icrontian

    I'm so lost

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    @primesuspect said:
    I'm so lost

    I had a computer compete 25,000 different combinations of settings against each other for a trading bot, and the one that won would have worked pretty good over the last 4 months.

    I'm trying to see if it'll work as well for the next 4 months.

  • primesuspectprimesuspect Beepin n' Boopin Detroit, MI Icrontian

    Candles?

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    candles are an indicator for 5/15/30/60 minute blocks of time for pricing, in this case USDT-BTC trading, represented by:

    a wick on the top - shows how high the price got within that candle's period. "sometime in this 30-minute period, BTC got up to 10,000"

    the color of the candle - green means it went up and red means it went down in that 30-minute period

    the top and bottom of the candle body are where the price entered and exited for that 30-minute period.

    a wick on the bottom- shows how low the price got within that candle's period. "sometime in this 30-minute period, BTC went down to 7,000"

    So if there are huge top wicks for 4 30-minute periods (2 hours)... but all the candles have about the same entry/exit price... it means the price repeatedly is spiking and coming back down - saying that SOMEONE thinks the price should go up, but there's not enough support from the market to make it happen.

    Which is usually a bad sign for the price, because the entire market just saw BTC fail to convince anyone it should go up in price...so maybe everyone should get out now, because this is as high as anyone agrees it should be.

    Just one example.

    primesuspect
  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    basically - there's a bigger story to price activity than just a line.

    primesuspect
  • primesuspectprimesuspect Beepin n' Boopin Detroit, MI Icrontian

    Makes sense. Thank you!

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    I've been genetic-algorithm backtesting more strategies. This time, CCI.

    The poor little dual-core machine I built for IC-LAN 2007 has a hard time calculating 5 backtests at a time. Takes forever, and I made a screen-reader script to restart the testing while I'm AFK because it was crashing out.

    I was at around 1100 epochs, and everything was OK. Was showing a 29% profit for my test date range. Then around epoch 1300, it found a way to boost that to about 67%, but the data it came up with doesn't work when I backtest it in the GUI. Not sure what happened, but the algorithm seems to have latched on to some faulty data and now is channeled into exploring that, with no further improvements at epoch 1650.

    I think I'll have to stop it, and while I'm at it I'm going to move on to testing another strategy. Again, my goal is to try and identify strategies that can generally do well in all conditions (extremely unlikely), or do well only in up- or down-market conditions. Finding one of each would be ideal because then an indicator for up or down could switch between them, and that's relatively easy to do.

    If I can find 2 of each (4 total, plus the up/down switching indicator) even better, because it's easy to set them to 'if you two agree we're in a buy or sell condition, then I'll do it, otherwise no.'

    Last-known good config for CCI:

    Bad data the testing is now stuck on / ignoring all other developments because of:

  • RyanFodderRyanFodder Detroit, MI Icrontian

    I hadn't known what candles were, or how to interpret them before! That was really useful, thanks!

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    I'm no expert, and there is waaaay more you can do with that info. YouTube 'technical analysis'.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    Typical experience with the genetic backtesting: runs for 24 hours and never finds anything profitable to start fine-tuning. I entered too big of a spread for the variables, and 99% of the results are orders of magnitude off what would normally be used. Whoops.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    The ROI numbers are starting to come in for those ASICs I ordered. Looks like the Siacoin one will be about $5/day, and the Decred one will be about $50/day. I want to see an ROI of < 90 days, because the next best ASIC will likely arrive then and mine will be obsolete.

    Current ROI estimates: 500 days for the SC1 and 50 days for the DCR1. Together they're 90.9 days. Glad I bought one of each... :/

    My hope is that Siacoin hard-forks in the next 2-4 weeks. The SC1 is made in partnership with Siacoin devs, is already set up to handle the next algo SC would use, and the ~6000 (or so?) SC1's would be the only functioning ASIC on Siacoin for 4-6 weeks while players like Bitmain retool. This hasn't happened before (clearing out a coin of tens of thousands of ASICs and having one limited-production model remain), but I'd hope for an ROI of < 10 days...

    The manufacturer is working on instructions on how to switch out the chips...and I can't imagine why they'd do that unless it's for a new algo...

    I almost want to double-down on the gamble and buy some disheartened person's SC1, but I don't have the spare cash...

  • AlexDeGruvenAlexDeGruven Wut? Meechigan Icrontian
    edited May 2018

    Been having some fun stress-testing a new server at work. With much help from @djmeph in wrapping my head around a few ideas.

    I figured a Monero miner would be an interesting way to beat up on the CPU and get a benchmark.

    The test server: IBM S822L - 2x 10-core p8 CPUs at 3.6GHz with 512GB RAM (80MB L3 cache per socket).

    1 thread with SMT off - 129 H/s
    .
    .
    .
    20 threads (1 thread per core) with SMT off - 2580 H/s

    I have seen very few things in life that scale in a perfectly linear way, so that was pretty neat.

    Instead of going through all 20 new threads in SMT 2 mode, I just gave it 40 threads with SMT 2 on

    40 threads (2 threads per core) - 4154 H/s.

    So, by turning on SMT2, I took about a 20% hit in hash rate per thread, but by doubling the number of threads, I got a 61% gain in overall throughput.

    Now, the idea of doing real mining on this gear is intriguing, but the numbers just aren't there.

    As configured, this box runs about $25k. Couple that with 1400W PSU and a CPU TDP of ~200W, and the power requirements are pretty heavy.

    Just thought I'd drop my little adventure in here.

    Edit: And no, this isn't going to be a long-term thing, just an easy way for me to try out different combinations of things before I give it over to my big data guys who will be doing the real work on it.

    Edit #2: For anyone thinking about leveraging this type of hardware, it looks like 2 threads per core is the optimal spot for this processor. It makes sense, really. Hardly anyone outside of purpose-built workloads is coding for SMT >2. It's been an interesting experiment, for sure. It kind of makes me want to start looking into an OpenPower box for personal messing about.

    Edit #3: Found an updated version of xmr-stak. Getting slightly lower performance overall with the same settings. Will have to poke around and see what tweaks have come in.

    Edit #4: xmr-stak using SMT4 gives me a per-thread of ~54H/s, considerably lower hash per-thread than SMT1 and SMT2, but more than half of SMT2's hashrate. By doubling the thread count again, I get another 5%ish bump in hashrate (which is actually consistent with most workloads under SMT4 in p8) for a current total of ~4.3kH/s. And keep in mind, this is still CPU-only, there's no GPU in this box.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    Tried looking for some good DEMA settings, it never found one profitable combination in 2700 epochs. Probably not a good sign.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    MACD, on the other hand, came up with a 70-something percent gain in the first few epochs. 30 epochs in, it found a 91% configuration! I let it go overnight, and it looks like the coding has a memory hole or something - it restarted something 84 times.

    After 42 completed epochs, it found a config for 141% gains. By far the furthest one yet. Going to let it run while I'm at work today and see if it can do better.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    I let MACD run for another 24h, and it didn't come up with anything else. My home office is getting hot from my machine running simulations 24/7!

    Testing PPO next.

    edit: PPO hit with a 49% gains config in its very first epoch, but uses 140+ trades to do it. Very likely that will get much more efficient / better, looking good!

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    side note: the goal is to find everything I can that works, then backtest the 30 days following my test date range to see if the results are legit, or if they're simply well-fit to the test data alone. I chose a test date range that had a mix of different conditions and events on purpose...but we'll see if it makes a difference.

  • RyanMMRyanMM Ferndale, MI Icrontian

    Paging @djmeph

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    PPO was very compute-intensive. Using 10-instance epochs, I had to drop it down to test one instance at a time. This made epochs take between 30 seconds and 5 minutes each.

    However, I let this run for 2 days and came up with some very interesting results. As suspected, PPO's initial 49% gain result improved - to over 79%!

    I'm continuing to see strategies that, when optimized, are only kicking in in certain conditions. That's ideal because a good indicator of current conditions could facilitate a switch to whichever strategy is the best fit for that condition.

    RSI next.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    RSI finished with the biggest gains yet, but it does it in only 4 trades. This seems like it's only applicable to the test dates...or it might be the best indicator yet for when there's going to be a bull run. If so, I'd definitely make sure nothing else cuts it short for the one time every 4 months it's going to kick in, etc. IF RSI buys, then nobody touch it until RSI sells, etc. Risky, if RSI just got lucky here it would be a disaster. Hmm.

    Going to see if a similar result comes from using RSI in a different way: via the Stochastic Oscillator.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    StochRSI came up with these settings early on, and 1200 epochs later they haven't been improved upon. Interesting graph, and quite a unique set of conditions it gets activated.

    I like the idea od the stop-loss, so I'm going to run the RSI strategy from above with a stoploss added in, see what happens.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited May 2018

    I let a Stoploss-RSI strategy run for about 6000 epochs. (It crashed a few times and the count got reset)

    About 1000 in, it came up with a 70%+ gain model. Running an additional 5000 epochs improved it to 111%. Funny enough - it almost identical performance to a non-stoploss RSI, but with a different trading pattern.

    I also "rescued" a 28" monitor from work, sorry if these screenshots look wonky, haven't messed with the display settings yet!)

    Testing an TMA strategy next. It's like TEMA, but instead of acting on exponential averages, it's a simple moving averages. The idea of exponential averages is to increase the sensitivity so the strategy can move faster - curious to see if it works.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited June 2018

    I went on vacation for a week and TMA run. Crashed a few times, restarted remotely.

    It ended up running about 30,000 epochs. Interesting that it used unexpected values for short, medium and long. As it turns out, inverting them worked very well with this test data.

    But that yielded 101% returns:

    Have been delayed / really busy. Didn't have time to sort out a problem: I followed some instructions on how to built a test environment using bash on Windows and split it out into two prompts, thinking it might be more stable / faster. Then I forgot how to get back into my test environment. Oops.

    Back in now.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    Testing these "best-fit" settings:

    Here's 24DEC to 14JUN, with the dividing line between the original test data (left) and the follow-up test data (right):

    The market went into a general decline, so this might be a test for which trading strategy works well when

    • the market is uncertain, going up and down, and
    • the market is in an overall decline, but
    • not a great test for when the market is rising

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited June 2018

    It looks like the ones who are best-fit for a higher-volume, uncertain market don't fare too well when those conditions don't exist.

    It seems like the slow and steady mediocre performers handle both high- and low-volume conditions much better, namely the configs the algo found for PPO, TEMA and Stoch RSI.

    24DEC to 14JUN timelines for those three

    PPO: Seems pretty happy in wild markets. Weird how it sold off in the beginning of May and just opted-out of the next 7 weeks of decline or so. I'd almost say 'not fair', but that's what it's supposed to do.

    TEMA: this one's neat to see. It's mostly jumping in and out, just taking little chips off every time certain conditions are met - and those conditions seem to be every time the market price is about to level out, but not quite at its peak yet.

    Stoch RSI: This is the most interesting of the bunch - it only works when the market is going down, catching all the little upticks the market normally goes through as it tests each price to see if that's really the market sentiment, or if it's going to go down even further.

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian

    TEMA & Stoch RSI overlay:

    PPO & Stoch RSI overlay:

    TEMA & PPO overlay:

    TEMA, PPO & Stock RSI overlay:

  • the_technocratthe_technocrat IC-MotY1 Indy Icrontian
    edited June 2018

    OK, well with this software I can only run one strategy at a time, so unless I can find a way to merge the code from 3 into one, I have to pick one.

    Since the market seems to be in a general decline, I've set up a tradebot on Stoch RSI and gave it $300 to use.

    It looks like it just sits and waits, then does 1-4 trades per day, then waits. We'll see what happens!

Sign In or Register to comment.