<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Sascha Becker on Medium]]></title>
        <description><![CDATA[Stories by Sascha Becker on Medium]]></description>
        <link>https://medium.com/@s.becker?source=rss-642d4cfaf4d1------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*NnBY2_zhLi2Rb5ojLQklgw.jpeg</url>
            <title>Stories by Sascha Becker on Medium</title>
            <link>https://medium.com/@s.becker?source=rss-642d4cfaf4d1------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 01:22:54 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@s.becker/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Material Design 2 — more than just rounded corners]]></title>
            <link>https://medium.com/wertarbyte/material-design-2-more-than-just-rounded-corners-51e672e972a1?source=rss-642d4cfaf4d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/51e672e972a1</guid>
            <category><![CDATA[material-design]]></category>
            <category><![CDATA[google]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[web]]></category>
            <dc:creator><![CDATA[Sascha Becker]]></dc:creator>
            <pubDate>Fri, 11 May 2018 14:50:00 GMT</pubDate>
            <atom:updated>2018-05-11T14:50:00.285Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*tIOufDyXyCbog64OBiUrfg.png" /><figcaption><a href="https://material.io/">https://material.io/</a></figcaption></figure><h3>Material Design</h3><p>Google first showed it’s vision for the next UI principles in 2014.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F1TbbLzCBwj0%3Ffeature%3Doembed&amp;url=http%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D1TbbLzCBwj0&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F1TbbLzCBwj0%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/35bdbc6db1823f658cdab1b1f3bea95c/href">https://medium.com/media/35bdbc6db1823f658cdab1b1f3bea95c/href</a></iframe><p>So with Google I/O 2018 an iterativ version of material design was published.</p><p>Many things were left untouched, which is good because it worked well so far. Some things are now tweaked and enhanced to provide better freedom for creative UI designers. And some new stuff was added. Let’s break it down.</p><h3>Goals</h3><p>The first version of the Material Design guidelines had two fundamental goals which it achieved very well over the past few years.</p><h4><strong>Create</strong></h4><p>Create a visual language that synthesizes classic principles of good design with the innovation and possibility of technology and science.</p><h4><strong>Unify</strong></h4><p>Develop a single underlying system that allows for a unified experience across platforms and device sizes. Mobile precepts are fundamental, but touch, voice, mouse, and keyboard are all ﬁrst-class input methods.</p><p>If you want to read more about the first version, head over to the archived guidelines.</p><p><a href="https://material.io/archive/guidelines">Introduction - Material Design</a></p><p>Designs that adopted the Material Design guidelines were pretty intuitive. But they had one thing in common, they <em>looked and felt nearly all the same</em>. You might argue that this a good thing, but if you want to present your brand, it’s certainly not. That’s why Google added a third goal this year.</p><h4>Customize</h4><p>Expand Material’s visual language and provide a flexible foundation for innovation and brand expression. Take a look at the talk to see what can be now achieved by just making a few tweaks.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2F3VUMl_l-_fI%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3D3VUMl_l-_fI&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2F3VUMl_l-_fI%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/47a6605c4c210475b4b260ab972f25bf/href">https://medium.com/media/47a6605c4c210475b4b260ab972f25bf/href</a></iframe><h3>Principles</h3><p>Material Design started with three very important key principles.</p><h4>Material is the metaphor</h4><p>Material Design is inspired by the physical world and its textures, including how they reflect light and cast shadows. Material surfaces reimagine the mediums of paper and ink.</p><h4>Bold, graphic, intentional</h4><p>Material Design is guided by print design methods — typography, grids, space, scale, color, and imagery — to create hierarchy, meaning, and focus that immerse viewers in the experience.</p><h4>Motion provides meaning</h4><p>Motion focuses attention and maintains continuity, through subtle feedback and coherent transitions. As elements appear on screen, they transform and reorganize the environment, with interactions generating new transformations.</p><h3>Two new principles</h3><p>To achieve the new goal of customization, they had to expand that list a bit.</p><h4>Flexible foundation</h4><p>The Material Design system is designed to enable brand expression. It’s integrated with a custom code base that allows the seamless implementation of components, plug-ins, and design elements.</p><h4>Cross-platform</h4><p>Material Design maintains the same UI across platforms, using shared components across Android, iOS, Flutter, and the web.</p><h3>Colors</h3><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2FxYkz0Ueg0L4&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3DxYkz0Ueg0L4&amp;image=http%3A%2F%2Fi.ytimg.com%2Fvi%2FxYkz0Ueg0L4%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/9b0699515b3872c50bdac0a7b82be2a7/href">https://medium.com/media/9b0699515b3872c50bdac0a7b82be2a7/href</a></iframe><p><a href="https://material.io/archive/guidelines/style/color.html#">Color - Style - Material Design</a></p><p>That’s how it started. A predefined color palette and I, as a developer, was happy that my decisions were made so easy. It even says so in the video title!</p><p>And now, for the new goal and principles, we have the choice for even more colors. Like all the colors. Want your app to be purple but kinda blue? No problem, go for it!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*uNfp9jsEENQgZqVq.png" /></figure><p>So they defined three principles for colors.</p><h4>Hierarchical</h4><p>Color indicates which elements are interactive, how they relate to other elements, and their level of prominence. Important elements should stand out the most.</p><h4>Legible</h4><p>Text and important elements, like icons, should meet legibility standards when appearing on colored backgrounds, across all screen and device types.</p><h4>Expressive</h4><p>Reinforce your brand by showing brand colors at memorable moments that reinforce your brand’s style.</p><p><a href="https://material.io/design/color">The color system</a></p><h3>Shape</h3><p>Up until now we had round buttons, slightly round corners and hard corners. Now we can have every combination with various settings involved.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5NwaS0Joh4PEso8l.png" /></figure><p>Material surfaces have a rectangular shape by default, with 4dp rounded corners. They have adjustable:</p><ul><li>Corner angles and curves</li><li>Edge angles and curves</li><li>The number of corners</li></ul><p>Shape changes, such as rounded or clipped corners, can be subtle or more significant.</p><p><a href="https://material.io/design/shape/about-shape.html">Material Design</a></p><h3>Components</h3><h4>App bar</h4><p>We already know and love the app bar. It’s placed at the top and provides space for our burger menu icon, a title and various actions we need.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*ZeSNdKPlX2ElCrBg.png" /></figure><p>But you know what loves the top space? The notch. Oh the glorious notch. You may noticed the iPhone X UI tweaks to integrate the notch better into current designs. And it’s coming to android, too. Scaled page titles and all the top actions are now on the bottom. They don’t say it but that’s why the app bar bottom was introduced.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*MrmnIeOaXAaEw1i4.png" /></figure><p>It shifts the current app bar to bottom and basically acts like normal. But what about a FAB (Floating Action Button). Doesn’t it get in the way you may ask?Yes, it would. So they just merged it.</p><p>There are various variants on how the FAB is placed and its visual appeal. It can even be placed in a cutout.</p><p><a href="https://material.io/design/components/app-bars-bottom.html">App bars: bottom</a></p><h4>Button</h4><p>What’s the primary action on this page? That’s what every designer asked in the past. And in most cases it was very easy to define what’s a <em>primary </em>and what’s more a <em>secondary </em>action. Use<em> flat buttons</em> if you need less prominence and<em> raised buttons</em> for more prominence.</p><p>With material design 1 we had flat buttons and raised buttons. In combination with the primary or <em>secondary </em>color a distinction was easy to make. But sometimes we wished for a “in-between” button to display a special use case. That’s what’s new!</p><p>They renamed flat buttons to text buttons and raised buttons to contained buttons. And they called the “in-between” button outlined button.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/0*F5RubobFy7Pn00YU.png" /></figure><p>This will make different emphasis easier to display and gives designers more options to work with.</p><p><a href="https://material.io/design/components/buttons.html">Buttons</a></p><h4>Sheet</h4><p>Oh the lovely sheet. Drawers’ little brother. It is basically just a paper element which would raise from the button to display beautiful actions or details. In some cases it is even persistent and provides actions used in media playback.</p><p>Some designs needed to display options on the side. Like filters, sort options or additional details. We had to build this ourselves. But no more my friend. I introduce the sheet on the side!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KEAQYW0XO_7u8zeO.png" /></figure><p>It works just like the bottom sheet but now on the side. Use it in a persistent state or like a modal and let it overlap your content.</p><p><a href="https://material.io/design/components/sheets-side.html">Sheets: side</a></p><h4>Backdrop</h4><p>This is a completely new component. It combines the content displayed in the front layer with details, filters or other actions related to that content in the back layer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IXPbQbUpJ5QNfnTwn9ruVA.gif" /></figure><p><a href="https://material.io/design/components/backdrop.html">Backdrop</a></p><h4>Text fields</h4><p>Input fields just had a label, its input area and an underline. Now there are two options to use. Filled text and outlined text.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*hOHC2MVbQlqiY754.png" /></figure><p>Filled text fields carry more visual emphasis, making them stand out when surrounded by other content and components.</p><p>Outlined text fields have less visual emphasis than filled text fields, which helps simplify layout in places like forms, where many text fields are placed together.</p><p><a href="https://material.io/design/components/text-fields.html">Text fields</a></p><h3>Conclusion</h3><p>Many subtle but very important changes for achieving the new goal towards more customization. Also really cool new additions which will address past confusion.</p><p>These changes will lead to different variations and adaptions of the standards while still look and feel different.</p><p>For me as a developer and designer it’s still a big pill to swallow as I just thought I mastered material design 1. But change and progress is good for everyone.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=51e672e972a1" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wertarbyte/material-design-2-more-than-just-rounded-corners-51e672e972a1">Material Design 2 — more than just rounded corners</a> was originally published in <a href="https://medium.com/wertarbyte">Wertarbyte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Bugs that were turned into features]]></title>
            <link>https://medium.com/vollkorn-games/bugs-that-were-turned-into-features-a0f435dc32b9?source=rss-642d4cfaf4d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a0f435dc32b9</guid>
            <category><![CDATA[bugs]]></category>
            <category><![CDATA[features]]></category>
            <category><![CDATA[gaming]]></category>
            <category><![CDATA[videogames]]></category>
            <dc:creator><![CDATA[Sascha Becker]]></dc:creator>
            <pubDate>Tue, 24 Apr 2018 19:28:24 GMT</pubDate>
            <atom:updated>2018-04-24T19:28:24.187Z</atom:updated>
            <content:encoded><![CDATA[<p>David Amador <a href="https://twitter.com/DJ_Link">https://twitter.com/DJ_Link</a> posted some pretty cool bugs that were later essential features. I just wanted to collect them in one space with some others I’ve found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8eTKZjQkDGmRC_NN_7D-wQ.jpeg" /></figure><h3>GTA 1</h3><p>Race ’n’ Chase, an early version of Grand Theft Auto, left future GTA developer Gary Penn feeling like a huge failure. The software always crashed and worse, the multiplayer racing game was boring. Due to a bug in the coding, when computer-controlled cops tried to pull over a human-controlled suspect, the police car would sometimes attempt to occupy the same space as the getaway car and a fiery wreck would be triggered. The testers hated the game and spent all of their time trying to trigger the bug that caused the violent crashes. Race ’n’ Chase disappeared into the trash and GTA was born.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/384/1*JM5MmRfMwKKv6M-TGEkZrw.gif" /></figure><h3>Gmail</h3><p>Yes, the undo feature that we see now on Gmail, actually was born out of a bug. Gmail went through 5 seconds delay while processing an email. Developers who were working on Gmail smartly turned that bug into the most useful feature of Gmail.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/659/0*yWOlKbBX_nTaPuii.png" /></figure><h3>Hidden files in Linux</h3><p>The feature that we use in Linux and Unix where we hide our files by simply putting a dot(.) before the filename. Well, it was a bug in Linux and Unix which wasn’t fixed.</p><h3>World of Warcraft</h3><p>In 2005, World of Warcraft developers introduced the Corrupted Blood Spell, which was meant to selectively curse the game’s avatars with ill health. The debilitating effect was intended to last a short time and stay contained in a controlled environment, but the infectious disease escaped and sowed death and destruction in the virtual world of WoW. Epidemiologists made ​​good use of the phenomenon by using it for research into methods for containing pandemics in the real, physical world.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*4PxvKiO5UWr20OeW.jpg" /></figure><h3>CTRL + ALT + DEL</h3><p>Control-Alt-Delete is the invention of David Bradley, the developer who worked on the first IBM PC. He invented the command to help programmers save time by booting without having to wait for shutdown so that the flow of their work would not be interrupted. It was never his intention for the three-finger salute to become so familiar to end users. In a panel discussion attended by Bill Gates, Bradley explained, saying, “I may have invented it, but Bill made ​​it famous.” And indeed, last week <a href="http://edition.cnn.com/2013/09/26/tech/innovation/bill-gates-control-alt-delete">Bill Gates admitted</a> in a Q&amp;A on Harvard University that the triple-key combination should have been made easier. “We could have had a single button. But the guy who did the IBM keyboard design didn’t want to give us our single button.”</p><h3>Devil May Cry</h3><p>During dev of Onimusha Capcom noticed a bug in the combat physics. Enemies could be launched into the air, by attacking them quickly they could keep them airborne. It didn’t fit the game, so they tested in Resident Evil 4, but eventually simply created a new IP, Devil May Cry.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/512/1*4zbo0q0RkGfhSEHwcg0bRA.gif" /></figure><h3>Lara Croft</h3><p>Lara Croft’s bustiness in Tomb Raider was originally an error. This is the story:</p><p>“While making test adjustments to her girlish figure, a slip of his mouse turned an intended 50 per cent increase to her breast size into a 150 per cent gain. It met with instant approval from the team before he could correct it.”</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*5ZODNb8bTxdoKo2Y.jpg" /></figure><h3>Super Mario 3D World</h3><p>In Super Mario 3D World while working with the placement tool/editor one of the devs made a mistake and left 2 Marios in a level. When the rest of the team saw that they decided to create a power-up for that purpose, the Double Cherry, allowing up to 4 clones.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*1uTiDXn_okZ_9jt3Kc8zNQ.gif" /></figure><h3>Myspace</h3><p>The ability to edit the html/css of Myspace profiles started as a bug, although it later turned into the strength of Myspace.</p><h3>Crazy Taxi</h3><p>A bug in the original Crazy Taxi allowed the players to jump their cars with with a gear changing technique. While only religious player knew this trick to jump parts of the level and shorten their routes, it was introduced as a full fledged feature in Crazy Taxi 2.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*Vw44Eho--9qWJJCzlnleew.gif" /></figure><h3>Mortal Kombat</h3><p>Arcade version of Mortal Kombat had a hidden diagnostic screen showing some stats, one was “ERMACS” error macros. A rumor spread, including magazines that it was a hidden character. Became so popular that Midway created Ermac in Ultimate Mortal Kombat 3 as a red palette Scorpion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*Q19JUk9X6OBfz4pA.jpg" /></figure><p>ERMAC the character from Mortal Kombat was an alleged glitch. The original game was written in macro to catch coding errors also known as <strong><em>er</em></strong>ror <strong><em>mac</em></strong>ro. Hence every time there was an error during a game the “<strong>ermac</strong>” text would display, causing speculation that a new character would be introduced. Finally ERMAC was introduced in Ultimate Mortal Kombat 3</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/240/0*eL4NURtKhohUZ0ZQ." /></figure><h3>Street Fighter II</h3><p>Combos, now present in all fighting games were introduced with Street Fighter II by accident. During dev the bug was found on the car bonus stage, allowing several attacks, but timing required to make it happen was considered too difficult to pull off so they left it</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/570/1*OCHdUVc_oZ8egpIWvuT6Pw.gif" /></figure><h3>Minecraft</h3><p>Minecraft Creepers were created by accident, dev was attempting to create a pig using only code (he had no 3D modeling tools), mistakenly used height instead of length and created a weird tall looking creature instead. it was kept as an enemy.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/427/1*wHo6A6iPgEwinpsBNobFpQ.gif" /></figure><p>The <strong>BUD </strong>switch (Block update detector) in Minecraft.</p><p>When introducing the “Piston” in Minecraft, there was a bug introduced where specifically placed redstone would not activate a Piston. The only way the Piston would activate if a nearby block would change state, as a “changing” block will tell it’s nearby blocks to check their state, and if needed update it. A Piston in a “wrong” state would then activate.</p><p>This allowed players to effectively build contraptions that would respond to new blocks placed, blocks removed, or blocks changing state (eg: gras growing, oven activation and more).</p><p>The game creator stated that they have no intention of removing this bug.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/720/1*xuDLdFHxzQWdE8jWxVwqug.gif" /></figure><h3>Super Mario Bros</h3><p>Super Mario Bros. multi-coin blocks were initially a bug, it was supposed to be always 1 coin. Programmer fixed it, but after designers saw that it added something to the game they decided to add it back in.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/256/1*3lfSAKs2k_fvqbBbJdFQPQ.gif" /></figure><h3>Quake</h3><p>Quake had a bug where pressing a direction key would add a unit in that direction, but final sum was never normalized, a combination of movements would increase top speed. Devs decided to leave it in and this became a standard in many other FPS until today, called Strafe-jumping.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/444/1*rjONBK0LgUdDfUNTG-zkCQ.gif" /></figure><h3>Space Invaders</h3><p>Space Invaders was built at a time where microcomputers were slow for games. Tomohiro Nishikado noticed that as he killed aliens and remove them from screen the game ran faster, it felt like difficulty was increasing. that side effect was turn into a feature.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/448/1*n6vmlghfEYLFgKUmXekn5A.gif" /></figure><h3>Team Fortress 1</h3><p>Team Fortress 1 (a mod for Quake) had a glitch in which a player name would show in the wrong color, making it look like they were on the opposite team. An easy fix but devs decided to create the Spy class, based on deception and sabotage.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*LqB0894V47LudfHl8iTALQ.jpeg" /></figure><h3>Wing Commander</h3><p>This is from an anecdote by Ken Demarest, one of the original developers who worked on Wing Commander I on the PC…</p><blockquote><em>… we were getting an exception from our EMM386 memory manager when we exited the game. We’d clear the screen and a single line would print out, something like “EMM386 Memory manager error. Blah blah blah.” We had to ship ASAP. So I hex edited the error in the memory manager itself to read “Thank you for playing Wing Commander!”</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/303/0*JwbmP3TJlaHJyGC9.jpg" /></figure><h3>Super Smash Bros Melee</h3><p>During a Super Smash Bros Melee tournament, one of the contestants tried to grab an item in the air, and accidentally slid across the screen without actually walking or running.</p><p>The technique, which is now known as a “wavedash” is an unintended physics exploit of the game that transfer the movement of the air dodge into a horizontal movement along the ground. It’s a required skill now to be competitive in the professional circuit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/636/1*G3a7LAhqP4FZZy5FBjE4OA.gif" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a0f435dc32b9" width="1" height="1" alt=""><hr><p><a href="https://medium.com/vollkorn-games/bugs-that-were-turned-into-features-a0f435dc32b9">Bugs that were turned into features</a> was originally published in <a href="https://medium.com/vollkorn-games">Vollkorn Games</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Cryptoverview — Your overview for crypto]]></title>
            <link>https://medium.com/wertarbyte/cryptoverview-your-overview-for-crypto-ca4b1988d546?source=rss-642d4cfaf4d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/ca4b1988d546</guid>
            <category><![CDATA[ethereum]]></category>
            <category><![CDATA[trading]]></category>
            <category><![CDATA[bittrex]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <dc:creator><![CDATA[Sascha Becker]]></dc:creator>
            <pubDate>Tue, 06 Mar 2018 18:49:07 GMT</pubDate>
            <atom:updated>2018-03-06T18:49:07.629Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_FYiBVuaw1yE17-8xt_Pcg.png" /></figure><p>Cryptoverview.com is our new project to bring more insights into your cryptocurrency portfolio and enhance the trading experience. It will visualize your assets in a donut graph, display your grows in a time graph, list trending currencies, display your individual assets with indicators, show closed and open orders. There are many more features yet to come.</p><p><a href="https://cryptoverview.com/">Cryptoverview</a></p><p><strong>Cryptoverview is still in a very early stage. If you run into problems or have something to say feel free to drop us a mail over at info@wertarbyte.com.</strong></p><p>In order to use Cryptoverview you need to connect your Bittrex account. For more information about that see this tutorial:</p><p><a href="https://medium.com/p/a3af8ef97b3d">How to use Cryptoverview with Bittrex? - Wertarbyte - Medium</a></p><blockquote>Cryptoverview currently only supports Bittrex. More API connections are planned.</blockquote><h3>The overview graphs</h3><p>At first you will be greeted by graphs displaying your current state. We offer a donut graph and a timeline chart with BTC and USD toggles at the moment.</p><h4>Donut Graph</h4><p>We crunch your portfolio values and display them in a portioned view. Now you can see which currency has which share of your total value.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/569/1*IcoFVnf5tmspIEf0ebBT3A.png" /><figcaption>Donut Graph</figcaption></figure><h4>Timeline Chart</h4><p>See your total value over the last days calculated by past buy and sell orders. Hover over a day to see more details on asset splits and its values.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*m_4KccxpgRXQZ6bhaegdpQ.png" /><figcaption>Timeline Chart</figcaption></figure><h3>Currencies</h3><p>The next area displays the top ten currencies in volumes from the last 24 hours. It also visualize your portfolio and its value in USD. It will refresh every few minutes on its own.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DueOQPfXSgcnWxw5u5qvMQ.png" /><figcaption>Top volumes and your portfolio</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/862/1*MN7tHFceV_5JQxby6xreCA.png" /></figure><p>Clicking on a currency shows a detailed view with even more indicators. We currently support EMA (26 and 9), RSI (14), BollingerBand and the volume chart. Every indicator can be toggled using the options menu in the upper right corner.</p><p>On the bottom you can switch between BTC and USD candles. This is very important if bitcoin keeps raising and your currency seems to fall but the USD value is instead stable. So try to keep both charts in mind. In the lower right corner you can change the interval for the candle data. We support one minute and up to day interval, just like Bittrex.</p><h3>News</h3><p>We’ve also added some news all about cryptocurrency. Currently these are based on a few RSS feeds. More endpoints may come.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KQKU0UO5igc2H5SjWkJIQw.png" /></figure><h3>Oder Tables</h3><p>To give you a better overview of your orders we list open and closed orders. This data will also be refreshed every few minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OqfNhCs2BNerTxb4hqhdTg.png" /><figcaption>Open and closed orders</figcaption></figure><h3>Web App</h3><p>As this is a web app we made it pretty responsive and with the latest fancy web technologies of today. Enjoy it on your smartphone via your browser.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/389/1*DDCb0BC5LWEAnmEsg9cAtw.png" /><figcaption>Currency top volumes on mobile</figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=ca4b1988d546" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wertarbyte/cryptoverview-your-overview-for-crypto-ca4b1988d546">Cryptoverview — Your overview for crypto</a> was originally published in <a href="https://medium.com/wertarbyte">Wertarbyte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to use Cryptoverview with Bittrex?]]></title>
            <link>https://medium.com/wertarbyte/how-to-use-cryptoverview-with-bittrex-a3af8ef97b3d?source=rss-642d4cfaf4d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/a3af8ef97b3d</guid>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[bittrex]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[api]]></category>
            <category><![CDATA[trading]]></category>
            <dc:creator><![CDATA[Sascha Becker]]></dc:creator>
            <pubDate>Tue, 06 Mar 2018 18:48:53 GMT</pubDate>
            <atom:updated>2018-03-06T18:48:53.379Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7XeIPCSN41a-WT-MvMAOBQ.png" /><figcaption>Cryptoverview displaying your current assets and recommendations</figcaption></figure><blockquote>Cryptoverview is our new project to bring more insights into your cryptocurrency portfolio and enhance the trading experience. It will visualize your assets in a donut graph, display your grows in a time graph, list trending currencies, display your individual assets with indicators, show closed and open orders. There are many more features yet to come.</blockquote><p>Cryptoverview currently only supports Bittrex. More API connections are planned. In order to connect this service you need to generate an API key pair in your Bittrex account.</p><h3>Step 1: Login to Bittrex</h3><p>Log into your Bittrex account and head over to the “Settings” menu</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/572/1*v5q0v7-DcinKm06az8IeCA.png" /></figure><h3>Step 2: Find the API area</h3><p>Select “API Keys” on the left side menu</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/693/1*4d1ohGGQ2EvO3xWfMJH9mg.png" /></figure><h3>Step 3: Create new API Keys</h3><p>Select “Add New Key” and a “new key” row will appear. Give it “Read Info”, input your Authentificator Code if you use one and press finally “Update Keys”.</p><p>The “Key” and “Secret” are needed for the next step.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hYCkGu2i8JBCfrZgtNHsMQ.png" /></figure><blockquote>Cryptoverview only needs the “Read Info” right. Future features may need more rights.</blockquote><h3>Step 4: Create a Cryptoverview account</h3><p>Head over to <a href="https://cryptoverview.com/">https://cryptoverview.com</a> and press “Create a new account”. Enter a unique username, a secret and strong password and your keys from <strong>Step 3</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/716/1*vs3cGrTlqMl8mbzmR2xtDQ.png" /></figure><h3>Step 5: Enjoy</h3><p>Now you’ve gained access. Your portfolio data will be crunched and displayed in various graphs, lines and tables. Cryptoverview is still in a very early stage. If you run into problems or have something to say feel free to drop us a mail over at info@wertarbyte.com.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a3af8ef97b3d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wertarbyte/how-to-use-cryptoverview-with-bittrex-a3af8ef97b3d">How to use Cryptoverview with Bittrex?</a> was originally published in <a href="https://medium.com/wertarbyte">Wertarbyte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[A cryptocurrency trading bot that doesn’t scam you]]></title>
            <link>https://medium.com/wertarbyte/a-cryptocurrency-bot-that-doesnt-scam-you-67b85d05a400?source=rss-642d4cfaf4d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/67b85d05a400</guid>
            <category><![CDATA[docker]]></category>
            <category><![CDATA[bitcoin]]></category>
            <category><![CDATA[cryptocurrency]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Sascha Becker]]></dc:creator>
            <pubDate>Tue, 14 Nov 2017 15:45:12 GMT</pubDate>
            <atom:updated>2018-11-01T15:10:22.759Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/780/0*rslltOp4vWpMGgUS.png" /></figure><p>Cryptocurrency trading bots are becoming the next big thing people think they need. And so they buy one. So did I.</p><blockquote>This is not a copy &amp; pasta example. It’s more a guideline on how to achieve what you want</blockquote><h3>Step 0: Learn throwing money away the hard way</h3><p>Investing in a third party cryptocurrency trading bot makes you feel you did the right thing. You can become finally rich by doing nothing. The bot will make money for you, right? Wrong!</p><p>You just gave away money to buy this bot to make the developer rich. And he does nothing, except some updates here and there. So in that way he does make money with a cryptocurrency bot.</p><p>But you are still not rich. Dang it! What to do?</p><h3>Step 1: Write your own</h3><p>The only bot you should trust comes from a codebase you build. It comes from a logic and pattern you invented. Don’t let anyone tell you what’s right.</p><p>I coded one and you can, too! So let’s get started. (Spoiler: I’m not rich, yet)</p><p>You can also clone my github repo if you want.</p><p><a href="https://github.com/TeamWertarbyte/crypto-trading-bot">https://github.com/TeamWertarbyte/crypto-trading-bot</a></p><h3>Step 2: Find a good cryptocurrency trading market</h3><p>This is the hardest part. Find a good place for your bot to trade on. Good starting points are either bittrex or kraken. The both have good APIs to work on.</p><p><a href="https://bittrex.com/Home/Api">https://bittrex.com/Home/Api</a></p><p><a href="https://www.kraken.com/help/api">Kraken | Buy, Sell and Margin Trade Bitcoin (BTC) and Ethereum (ETH) - API</a></p><p>Create an account and let’s get to the next step.</p><h3>Step 3: Define the bot environment</h3><p>For my bot I stuck with bittrex.com It has a solid API and good response times. They also provide a websocket for live updates.</p><p>The framework I’m using for this example is node js. But you can choose whatever you like. I wanted to have it run via docker-compose in the command line. So node js was a good pick.</p><p>The API can be accessed via a npm package like</p><p><a href="https://github.com/dparlevliet/node.bittrex.api">dparlevliet/node.bittrex.api</a></p><p>Or you write your own REST client to access bittrex. The documentation for the API in bittrex is quite outdated. It is for version 1.1 which is in use for quite some time now. Bittrex also accepts calls from, the not yet official released, version 2.0. The mentioned package for node does a pretty good job implementing the shiny new 2.0 calls. Use that!</p><h3>Step 4: Define your trade logic</h3><p>As you want to crunch the numbers you some market indicators. For me it was the EMA (Exponential Moving Average) value. You can read more about other values here:</p><p><a href="http://stockcharts.com/school/doku.php?id=chart_school:market_indicators">Market Indicators [ChartSchool]</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pmFIYVLaKWWUAgqrc-aOtw.png" /></figure><p>I chose two market indicators on an hour basis.</p><ul><li>(RED) EMA with a period of 50</li><li>(BLUE) EMA with a period of 15</li></ul><p>Alone they are not very effective. But look at those points where they cross. They are the ideal entry or exit points for buy or sell orders.</p><h4>So my trade logic was clear</h4><p><strong>Buy</strong> if EMA 15 is greater than EMA 50 and <strong>sell</strong> if EMA 50 is greater than EMA 15. This way my money is always in altcoins that are raising and once they fall sell it back to bitcoin.</p><p>This is just one out of dizillion combinations. Try what’s best for you. I’m working on an AI that detects the best market indicators and creates new ones but that will be another post.</p><h3>Step 5: Docker</h3><p>Your bot has to run 24/7 otherwise you won’t be profitable. So I wrapped my bot in a docker compose which runs forever.</p><p>Dockerfile:</p><pre><strong>FROM </strong>node:latest<br><br># Create app directory<br><strong>RUN </strong>mkdir <strong>-</strong>p <strong>/</strong>usr<strong>/</strong>src<strong>/</strong>app<br><strong>WORKDIR /</strong>usr<strong>/</strong>src<strong>/</strong>app<br><br># Install app dependencies<br><strong>COPY </strong>package.json <strong>/</strong>usr<strong>/</strong>src<strong>/</strong>app<strong>/<br>RUN </strong>npm install<br><br># Bundle app source<br><strong>COPY </strong>. <strong>/</strong>usr<strong>/</strong>src<strong>/</strong>app<br><br><strong>RUN </strong>npm run build<br><strong>CMD </strong>[ &quot;npm&quot;, &quot;start&quot; ]</pre><p>docker-compose.yml</p><pre><strong>version: </strong>&#39;2&#39;<br><strong>services:<br>  server:<br>    build: </strong>.<br>    <strong>restart: </strong>&#39;unless-stopped&#39;</pre><h3>Step 6: The loop</h3><p>Let’s define the loop and its configs. I will explain every loop action step by step so be patient. Our config object will grow over time. Our constructor creates three internal variables.</p><ul><li>bittrex — The access point to the bittrex api</li><li>currencies — Holds our populated coins, its values, market indicators and everything else coin related</li><li>bitcoin — It’s just the extracted bitcoin coin from the currencies</li></ul><p>I use bluebird as my promise library because of concurrency control.</p><pre><strong>const </strong>now = require(&#39;performance-now&#39;)<br><strong>const </strong>Promise = require(&#39;bluebird&#39;)<br><strong>const </strong>log = require(&#39;fancy-log&#39;)</pre><pre>Promise.config({<br>  cancellation: <strong>true<br></strong>})</pre><pre><strong>const </strong>configs = {<br>  cancelOpenOrdersOnStart: <strong>true,</strong><br>  refreshTimeout: 180000 // 3 minutes<br>}</pre><pre><strong>const </strong>INVEST_HOLD_OR_REJECT = {<br>  HOLD: &#39;HOLD&#39;,<br>  INVEST: &#39;INVEST&#39;,<br>  REJECT: &#39;REJECT&#39;,<br>  NONE: &#39;NONE&#39;<br>}</pre><pre><strong>export default class </strong>Watcher {<br>  constructor (bittrex) {<br>    <strong>this</strong>.bittrex = bittrex<br>    <strong>this</strong>.currencies = []<br>    <strong>this</strong>.bitcoin = {}<br>  }<br><br>  <strong>async </strong>watch () {<br>    <strong>const </strong>start = now()<br>    log.info(`## Started emma watch ##`)<br><br>    configs.cancelOpenOrdersOnStart &amp;&amp; <strong>await this</strong>.cancelOldOrders()</pre><pre><strong>    await this</strong>.fetchMarkets()<br>    <strong>await this</strong>.fetchBalances()<br><br>    <strong>await this</strong>.injectMarketSummaries(<strong>this</strong>.currencies)<br>    <strong>await this</strong>.filterCurrenciesByMarkets(configs.markets)<br>    <strong>await this</strong>.injectCandleData(<strong>this</strong>.currencies)<br>    <strong>await this</strong>.injectMarketIndicators(<strong>this</strong>.currencies)<br>    <strong>await this</strong>.countEmaCrossPointTicks(<strong>this</strong>.currencies)<br>    <strong>await this</strong>.injectClosedOrderHistory(<strong>this</strong>.currencies)<br><br>    <strong>await this</strong>.injectMarketSummaries(<strong>this</strong>.currencies)<br>    <strong>await this</strong>.evaluateInvestHoldOrReject(<strong>this</strong>.currencies)<br><br>    <strong>await this</strong>.rejectBadInvestments(<strong>this</strong>.currencies)<br>    <strong>await this</strong>.invest(<strong>this</strong>.currencies)<br><br>    log.info(`## Finished ${(now() - start).toFixed(5)} ms ##`)<br>    setTimeout(() =&gt; <strong>this</strong>.watch(), configs.refreshTimeout)<br>  }<br>}</pre><h4>Step 6.1: Cancel old orders</h4><p>Orders made by our bot may not always go through. So we have to cancel old orders if they won’t be accepted.</p><pre><strong>async </strong>cancelOldOrders () {<br>  <strong>const </strong>start = now()<br>  <strong>const </strong>openOrders = <strong>await this</strong>.bittrex.getOpenOrders()<br><br>  <strong>if </strong>(openOrders.length &gt; 0) {<br>    <strong>for </strong>(<strong>let </strong>openOrder <strong>of </strong>openOrders) {<br>      <strong>const </strong>elapsedHours = (<strong>new </strong>Date() - <strong>new </strong>Date(openOrder.Opened)) / 1000 / 60 / 60<br>      <strong>if </strong>(elapsedHours &gt; configs.maxHoursToHoldOrder) {<br>        log.info(`Cancel ${openOrder.OrderType} on ${openOrder.Exchange} du to older than ${configs.maxHoursToHoldOrder} hours`)<br>        <strong>await this</strong>.bittrex.cancel({uuid: openOrder.OrderUuid})<br>      }<br>    }<br>    log.info(`Canceled old orders ${(now() - start).toFixed(5)} ms`)<br>  }<br>}</pre><p>I added a config variable to control elapsed hours to hold an order.</p><pre><strong>const </strong>configs = {<br>  cancelOpenOrdersOnStart: <strong>true</strong>,<br>  maxHoursToHoldBalance: 168, // 7 days<br>  refreshTimeout: 180000, // 3 minutes<br>}</pre><h4>Step 6.2: Populate the currencies</h4><p>We fetch the current markets and filter only the BTC markets. I don’t support ETH markets for now.</p><pre><strong>async </strong>fetchMarkets () {<br>  <strong>const </strong>start = now()<br>  <strong>this</strong>.currencies = <strong>await this</strong>.bittrex.getMarkets()<br><br>  // remove other market than BTC for now<br>  <strong>this</strong>.currencies = <strong>this</strong>.currencies.filter(c =&gt; c.BaseCurrency === &#39;BTC&#39;)<br>  log.info(`Fetched currencies ${(now() - start).toFixed(5)} ms`)<br>}</pre><p>Then we need to inject the current balances of the coins to see their actual value from our wallet. I also separate bitcoin at this stage.</p><pre><strong>async </strong>fetchBalances () {<br>  <strong>const </strong>start = now()<br>  <strong>const </strong>balances = <strong>await this</strong>.bittrex.getBalances()<br>  <strong>for </strong>(<strong>let </strong>currency <strong>of this</strong>.currencies) {<br>    <strong>const </strong>balance = balances.find((b) =&gt; b.Currency === currency.MarketCurrency)<br>    <strong>if </strong>(balance) {<br>      currency.balance = balance<br>    } <strong>else </strong>{<br>      currency.balance = <strong>null<br>    </strong>}<br>  }<br><br>  <strong>this</strong>.bitcoin = balances.find((b) =&gt; b.Currency === &#39;BTC&#39;)<br><br>  log.info(`Fetched balances ${(now() - start).toFixed(5)} ms`)<br>}</pre><h4>Step 6.3: Get market live data</h4><p>To get get <strong>BID,</strong> <strong>ASK</strong> and <strong>LATEST</strong> we need to inject the market summaries into our currencies.</p><pre><strong>async </strong>injectMarketSummaries (data) {<br>  <strong>const </strong>start = now()<br><br>  <strong>const </strong>marketSummaries = <strong>await this</strong>.bittrex.getMarketSummaries({_: Date.now()})<br><br>  <strong>await </strong>Promise.map(data, <strong>async </strong>(d) =&gt; {<br>    <strong>const </strong>marketSummary = marketSummaries.find((ms) =&gt; d.BaseCurrency === ms.Market.BaseCurrency &amp;&amp; d.MarketCurrency === ms.Market.MarketCurrency)<br>    d.marketSummary = marketSummary.Summary<br>  })<br><br>  log.info(`Injected market summaries ${(now() - start).toFixed(5)} ms`)<br>}</pre><h4>Step 6.4: Filter your currencies</h4><p>I added specific markets where I want to trade on.</p><pre><strong>const </strong>configs = {<br>  cancelOpenOrdersOnStart: <strong>true</strong>,<br>  maxHoursToHoldOrder: 0.5,<br>  refreshTimeout: 180000, // 3 minutes<br>  markets: [<br>    &#39;ADA&#39;,<br>    &#39;BCC&#39;,<br>    &#39;DASH&#39;<br>  ]<br>}</pre><p>You can filter also by volume or a specific BTC value. Or you just don’t filter and trade with all available coin.</p><pre><strong>async </strong>filterCurrenciesByMarkets (markets) {<br>  <strong>const </strong>start = now()<br><br>  <strong>this</strong>.currencies = <strong>this</strong>.currencies.filter(c =&gt; markets.includes(c.MarketCurrency) || (c.balance &amp;&amp; c.balance.Available &gt; 0))<br><br>  log.info(`Filtered currencies by selected markets ${(now() - start).toFixed(5)} ms`)<br>}</pre><h4>Step 6.5: Light the candles</h4><p>To crunch some market indicators we need the candles. A candle describes a value for the selected market in a timeframe with a given step interval.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/525/0*uSWzgqSY4E7MsRJz.gif" /><figcaption><a href="http://globaltrendtraders.com/technical-analysis/technical-analysis-of-stock-trends-1-chart-types/">http://globaltrendtraders.com/technical-analysis/technical-analysis-of-stock-trends-1-chart-types/</a></figcaption></figure><p>You can read more about candles here:</p><p><a href="http://globaltrendtraders.com/technical-analysis/technical-analysis-of-stock-trends-1-chart-types/">Technical Analysis of Stock Trends #1 - Chart Types</a></p><pre><strong>async </strong>injectCandleData (data) {<br>  <strong>const </strong>start = now()<br>  <strong>const </strong>_ = Date.now()<br><br>  <strong>const </strong>USDT_BTC = <strong>await this</strong>.bittrex.getCandles({<br>    marketName: &#39;USDT-BTC&#39;,<br>    tickInterval: configs.tickInterval,<br>    _<br>  })<br><br>  <strong>await </strong>Promise.map(data, <strong>async </strong>(d) =&gt; {<br>    d.candles = <strong>await this</strong>.bittrex.getCandles({<br>      marketName: `BTC-${d.MarketCurrency}`,<br>      tickInterval: configs.tickInterval,<br>      _<br>    })<br><br>    d.candles = d.candles.map((c, i) =&gt; <strong>this</strong>.parseCandleData(c, USDT_BTC[i]))<br>  }, {concurrency: 15})<br><br>  log.info(`Injected candle data ${(now() - start).toFixed(5)} ms`)<br>}<br><br>parseCandleData (d, USDT_BTC) {<br>  <strong>return </strong>{<br>    date: parseDate(d.T),<br>    open: USDT_BTC.O * d.O,<br>    high: USDT_BTC.H * d.H,<br>    low: USDT_BTC.L * d.L,<br>    close: USDT_BTC.C * d.C,<br>    volume: d.V<br>  }<br>}</pre><p>The step interval is a new config variable called tickInterval. You can go as low as five minutes or as long as several hours. I went with an hour as it’s more robust and I don’t want fast trading.</p><pre><strong>const </strong>configs = {<br>  cancelOpenOrdersOnStart: <strong>true</strong>,<br>  maxHoursToHoldOrder: 0.5,<br>  refreshTimeout: 180000, // 3 minutes<br>  tickInterval: &#39;hour&#39;,<br>  markets: [<br>    &#39;ADA&#39;,<br>    &#39;BCC&#39;,<br>    &#39;DASH&#39;<br>  ]<br>}</pre><p>Also not that I multiply the values with USDT_BTC. Bittrex always displays a BTC value. As I don’t want to trade on a given BTC instead on the actual USD value of the currency I have to calculate a bit.</p><p>You can skip the USDT_BTC part if you want to trade on raw BTC value curves.</p><h4>Step 6.6: Crunch the numbers</h4><p>It’s time to get our market indicators. But wait! You don’t have to calculate it by yourself. there’s a package for that. Install react stockcharts together with react and you got the math for free.</p><p><a href="https://github.com/rrag/react-stockcharts">rrag/react-stockcharts</a></p><p>I want to use EMA. We also need a time and date parser.</p><pre><strong>import </strong>{ timeParse } <strong>from </strong>&#39;d3-time-format&#39;<br><strong>import </strong>{ ema } <strong>from </strong>&#39;react-stockcharts/lib/indicator&#39;<br><br><strong>const </strong>parseDate = timeParse(&#39;%Y-%m-%dT%H:%M:%S&#39;)</pre><p>First let’s inject our market indicators.</p><pre><strong>async </strong>injectMarketIndicators (data) {<br>  <strong>const </strong>start = now()<br><br>  <strong>await </strong>Promise.map(data, <strong>async </strong>(d) =&gt; {<br>    d.keyFigures = <strong>await this</strong>.calculateMarketIndicators(d.candles)<br>  })<br><br>  log.info(`Calculated key figures ${(now() - start).toFixed(5)} ms`)<br>}</pre><pre>calculateMarketIndicators (data) {<br>  <strong>const </strong>ema50 = ema()<br>    .id(0)<br>    .options({windowSize: 50})<br>    .merge((d, c) =&gt; {d.ema50 = c})<br>    .accessor(d =&gt; d.ema50)<br><br>  <strong>const </strong>ema15 = ema()<br>    .id(1)<br>    .options({windowSize: 15})<br>    .merge((d, c) =&gt; {d.ema15 = c})<br>    .accessor(d =&gt; d.ema15)<br><br>  <strong>return </strong>ema50(ema15(data))<br>}</pre><p>The windowSize defines the timespan to calculate the indicators from.</p><h4>Step 6.7: Count steps since last EMA crossing</h4><p>As an <em>EMA Crossing </em>I define a point in time where my two defined EMA values (EMA50 and EMA15) crossed. Like a break even for cryptocurrencies.</p><pre><strong>async </strong>countEmaCrossPointTicks (data) {<br>  <strong>const </strong>start = now()<br><br>  <strong>await </strong>Promise.map(data, <strong>async </strong>(d) =&gt; {<br>    <strong>const </strong>lastKeyFigures = d.keyFigures[d.keyFigures.length - 1]<br>    <strong>const </strong>lastEmaDifference = lastKeyFigures.ema50 - lastKeyFigures.ema15<br><br>    d.positiveTicks = 0<br>    d.negativeTicks = 0<br>    <strong>for </strong>(<strong>let </strong>i = d.keyFigures.length - 1; i &gt; 0; i--) {<br>      <strong>const </strong>keyFigures = d.keyFigures[i]<br><br>      <strong>if </strong>(lastEmaDifference &gt; 0 &amp;&amp; keyFigures.ema50 - keyFigures.ema15 &gt; 0) {<br>        d.negativeTicks++<br>      } <strong>else if </strong>(lastEmaDifference &lt; 0 &amp;&amp; keyFigures.ema50 - keyFigures.ema15 &lt; 0) {<br>        d.positiveTicks++<br>      } <strong>else </strong>{<br>        <strong>break<br>      </strong>}<br>    }<br>  })<br><br>  log.info(`Counted ticks since last ema crossing ${(now() - start).toFixed(5)} ms`)<br>}</pre><p>Every currency now has either a positive or a negative step counter. This tells me how very good or very bad it would be to invest in this currency at this given point in time.</p><h4>Step 6.8: Inject closed order history</h4><p>In the past I made decisions on how much profit I made since I bought that coin. Or how much loss I gained since last buy order. Currently I don’t use that information.</p><pre><strong>async </strong>injectClosedOrderHistory (data) {<br>  <strong>const </strong>start = now()<br><br>  <strong>await </strong>Promise.map(data, <strong>async </strong>(d) =&gt; {<br>    d.orderHistory = <strong>await this</strong>.bittrex.getOrderHistory({<br>      market: `BTC-${d.MarketCurrency}`<br>    })<br>  }, {concurrency: 10})<br><br>  log.info(`Injected closed orders ${(now() - start).toFixed(5)} ms`)<br>}</pre><blockquote>Every currency now has a orderHistory array filled with old orders. Bittrex does sadly only serve orders from the last 30 days or 500 entries in total. So use that with caution.</blockquote><h4>Step 6.9: Refresh market history</h4><p>As we calculate and crunch the numbers time has passed by and the latest currency value might wrong at this time. So we refresh it in the loop.</p><pre><strong>await this</strong>.injectMarketSummaries(<strong>this</strong>.currencies)</pre><h4>Step 6.10: Decide where to invest and what to sell</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*O1Xk_bMt8kkB1xhi.jpg" /></figure><p>This will be the hardest part. When is it perfect to invest in a currency? When is it better to reject a current invest and start over? When do you do nothing and wait?</p><p>I decided to only look on my EMA crossings and how long the are now. That’s what my counted ticks are for. I also added a minimum tick counter value config variable to prevent invest hopping (buy, sell, buy, sell in a short time).</p><pre><strong>const </strong>configs = {<br>  cancelOpenOrdersOnStart: <strong>true</strong>,<br>  maxEffectiveLoss: 60, // 60%<br>  maxHoursToHoldOrder: 0.5,<br>  refreshTimeout: 180000, // 3 minutes<br>  tickInterval: &#39;hour&#39;,<br>  markets: [<br>    &#39;ADA&#39;,<br>    &#39;BCC&#39;,<br>    &#39;DASH&#39;<br>  ],<br>  minimumEmaTicks: 5<br>}</pre><p>I also introduced a maximum loss cap to reject invest that fall way to low.</p><pre><strong>async </strong>evaluateInvestHoldOrReject (data) {<br>  <strong>const </strong>start = now()<br><br>  <strong>await </strong>Promise.map(data, <strong>async </strong>(d) =&gt; {<br>    <strong>const </strong>lastKeyFigures = d.keyFigures[d.keyFigures.length - 1]<br><br>    d.holdOrReject = INVEST_HOLD_OR_REJECT.HOLD<br><br>    <strong>if </strong>(d.balance &amp;&amp; d.balance.Available &gt; 0) {<br>      <strong>if </strong>(lastKeyFigures.ema15 &lt; lastKeyFigures.ema50 &amp;&amp; d.negativeTicks &gt;= configs.minimumEmaTicks) {<br>        log.info(`Will reject ${d.MarketCurrency} due to ${d.negativeTicks} negative ema ticks`)<br>        d.holdOrReject = INVEST_HOLD_OR_REJECT.REJECT<br>      } <strong>else if </strong>(d.balance.Available * d.marketSummary.Bid &lt; configs.btcPerInvest * (1 - configs.maxEffectiveLoss / 100)) {<br>        log.info(`Will reject ${d.MarketCurrency} due to falling below ${configs.btcPerInvest} btc`)<br>        d.holdOrReject = INVEST_HOLD_OR_REJECT.REJECT<br>      }<br>    } <strong>else if </strong>(!d.balance || (d.balance &amp;&amp; d.balance.Available === 0)) {<br>      <strong>if </strong>(lastKeyFigures.ema15 &gt; lastKeyFigures.ema50 &amp;&amp; d.positiveTicks &gt;= configs.minimumEmaTicks) {<br>        log.info(`Will invest in ${d.MarketCurrency} due to ${d.positiveTicks} positive ema ticks. EMA15 ${lastKeyFigures.ema15} &gt; EMA50 ${lastKeyFigures.ema50}`)<br>        d.holdOrReject = INVEST_HOLD_OR_REJECT.INVEST<br>      }<br>    }<br>  })<br>  log.info(`Evaluated invest hold or reject ${(now() - start).toFixed(5)} ms`)<br>}</pre><h4>Step 6.11: Reject bad investments</h4><p>As you evaluated investments as bad they will be sold. So let’s do so.</p><pre><strong>async </strong>rejectBadInvestments (data) {<br>  <strong>const </strong>start = now()<br><br>  <strong>await </strong>Promise.map(data, <strong>async </strong>(d) =&gt; {<br>    <strong>if </strong>(d.holdOrReject === INVEST_HOLD_OR_REJECT.REJECT) {<br>      <strong>if </strong>(d.marketSummary.Bid * d.balance.Available &gt;= configs.minimumSellBalanceInBTC &amp;&amp; d.balance.Available &gt; d.MinTradeSize) {<br>        <strong>try </strong>{<br>          <strong>await this</strong>.bittrex.sellLimit({<br>            market: `${d.BaseCurrency}-${d.MarketCurrency}`,<br>            quantity: d.balance.Available,<br>            rate: (d.marketSummary.Bid - configs.rateSellBuyExtraBtc)<br>          })<br>        } <strong>catch </strong>(e) {<br>          log.info(e)<br>        }<br>        log.info(`${d.MarketCurrency} placed REJECT SELL order`)<br>      }<br>    }<br>  }, {concurrency: 20})<br>  log.info(`Rejected investments ${(now() - start).toFixed(5)} ms`)<br>}</pre><p>I added configs.rateSellBuyExtraBtc to add a tiny amount of BTC to secure the sell and buy order. Also configs.minimumSellBalanceInBTC was added to check the bittrex sell threshold. Bittrex doesn’t allow orders smaller than that.</p><pre><strong>const </strong>configs = {<br>  cancelOpenOrdersOnStart: <strong>true</strong>,<br>  minimumSellBalanceInBTC: 0.0005,<br>  maxEffectiveLoss: 60, // 60%<br>  maxHoursToHoldOrder: 0.5,<br>  refreshTimeout: 180000, // 3 minutes<br>  rateSellBuyExtraBtc: 0.0000000000001, // to secure buy or sell<br>  tickInterval: &#39;hour&#39;,<br>  markets: [<br>    &#39;ADA&#39;,<br>    &#39;BCC&#39;,<br>    &#39;DASH&#39;<br>  ],<br>  minimumEmaTicks: 3<br>}</pre><h4>Step 6.12: Invest all the bitcoin!</h4><p>Now let’s throw all our remaining bitcoin value into currencies that seems worth it. I sorted my options by EMA ticks to invest in fresh risers first.</p><p>I also instroduced two new config variables.</p><pre><strong>const </strong>configs = {<br>  btcBuffer: 0.01, // btc that has to stay on the bank<br>  btcPerInvest: 0.005,<br>  cancelOpenOrdersOnStart: <strong>true</strong>,<br>  minimumSellBalanceInBTC: 0.0005,<br>  maxEffectiveLoss: 60, // 60%<br>  maxHoursToHoldOrder: 0.5,<br>  refreshTimeout: 180000, // 3 minutes<br>  rateSellBuyExtraBtc: 0.0000000000001, // to secure buy or sell<br>  tickInterval: &#39;hour&#39;,<br>  markets: [<br>    &#39;ADA&#39;,<br>    &#39;BCC&#39;,<br>    &#39;DASH&#39;<br>  ],<br>  minimumEmaTicks: 3<br>}</pre><ul><li><strong>btcPerInvest</strong> defines a fixed BTC value which will be used to make that order happen. You can also scale that value exponential based on your available bitcoin.</li><li><strong>btcBuffer</strong> defines a fixed btc value which has to stay and will not used for investment. I like to have some btc left for my manual trades.</li></ul><pre><strong>async </strong>invest (data) {<br>  <strong>const </strong>start = now()<br><br>  <strong>let </strong>buyCounter = 0<br><br>  // Sort by tick count from last ema crossing<br>  data.sort((a, b) =&gt; a.positiveTicks - b.positiveTicks)<br>  <strong>for </strong>(<strong>let </strong>d <strong>of </strong>data) {<br>    <strong>if </strong>(<strong>this</strong>.bitcoin.Available &gt; configs.btcPerInvest + configs.btcBuffer) {<br>      <strong>if </strong>(d.holdOrReject === INVEST_HOLD_OR_REJECT.INVEST) {<br>        <strong>const </strong>quantity = (configs.btcPerInvest - 0.00000623) / d.marketSummary.Ask<br><br>        <strong>if </strong>(quantity &gt; d.MinTradeSize) {<br>          <strong>try </strong>{<br>            <strong>await this</strong>.bittrex.buyLimit({<br>              market: `${d.BaseCurrency}-${d.MarketCurrency}`,<br>              quantity,<br>              rate: (d.marketSummary.Ask + configs.rateSellBuyExtraBtc)<br>            })<br>            buyCounter++<br>            <strong>this</strong>.bitcoin.Available -= configs.btcPerInvest<br>            log.info(`Invested ${configs.btcPerInvest} bitcoin in ${d.MarketCurrency} for ${quantity} amount`)<br>          } <strong>catch </strong>(e) {<br>            log.info(e)<br>          }<br>        }<br>      }<br>    } <strong>else </strong>{<br>      log.info(`Not enough btc left to invest. Keep saving more!`)<br>      <strong>break<br>    </strong>}<br>  }<br><br>  log.info(`Invested ${configs.btcPerInvest * buyCounter} btc in ${buyCounter} options ${(now() - start).toFixed(5)} ms`)<br>}</pre><h3>Step 7: Deploy</h3><p>The bot is done. I push the code onto my server and start it with</p><pre>$ docker-compose up --build -d</pre><p>This will build and start my bot. Logs can be viewed via logs of docker-compose.</p><h3>Step 8: Improve your bot</h3><p>Your bot will make errors, you will make bad invest decisions based on certain market indicators. Learn from it and improve your code. To be hones, my bot lost nearly half my money before becoming stable and making actual profit again. Don’t give up.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*zjEeAZCYHlyebNJP.jpg" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=67b85d05a400" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wertarbyte/a-cryptocurrency-bot-that-doesnt-scam-you-67b85d05a400">A cryptocurrency trading bot that doesn’t scam you</a> was originally published in <a href="https://medium.com/wertarbyte">Wertarbyte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Structure your react apps the mantra way]]></title>
            <link>https://medium.com/wertarbyte/structure-your-react-apps-the-mantra-way-3a831ffd1580?source=rss-642d4cfaf4d1------2</link>
            <guid isPermaLink="false">https://medium.com/p/3a831ffd1580</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[redux]]></category>
            <dc:creator><![CDATA[Sascha Becker]]></dc:creator>
            <pubDate>Mon, 18 Sep 2017 13:53:14 GMT</pubDate>
            <atom:updated>2018-07-26T15:47:10.764Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*8NZmfmtbFMYpqCWttlSZpA.jpeg" /></figure><p>The holy grail of discussion is what is the best way to structure your project. The answer is, there is none. But here is one I fell in love with.</p><h3>Then mantra way!</h3><p>First of let’s talk about what makes a structure good. There are certain elements that make good use of organisation.</p><ul><li>Easy to navigate</li><li>Scales well over time</li><li>Swap logic is fast and without many breaks</li></ul><p>So what exactly is mantra? I’m not talking about meditate while creating folders. It’s the <a href="https://kadirahq.github.io/mantra/">mantra js</a> spec application architecture developed by kadira back when meteor js was the cool kid.</p><p>It described an architecture that should be maintainable and future proof. They claimed once set up it will satisfy your inner geek for up to five years. Not even kadira lasted that long by the way, nor will maybe meteor.</p><p>So I moved on, turned my back from meteor and dived into the raw package land. And mantra js was the one thing that I loved and tried to embed.</p><p>Let’s take a look of what a project could look like. Here is an example of a website with multiple routes, components, actions and reducers.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*oJ9UHmPten6Cca-guXEffg.png" /></figure><p>Stay with me. It’s not that confusing as it seems.</p><h3>Modules</h3><p>Let’s break it down and we start with the modules folder. It’s the core idea of mantra and what makes it so great in my opinion.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/187/1*7jTl_gLHoqp36xtAHBDgLg.png" /></figure><p>Modules is business concern first. That means I don’t split it into</p><ul><li>components</li><li>containers</li><li>reducers</li><li>actions</li></ul><p>right here. Instead mantra adds a layer on top to achieve better maintainability and hopefully makes this future proof.</p><p>One important rule is that you <strong>don’t cascade modules</strong>. If a module should have a submodule create it separately. The advantage is that you see all modules at a glance. You don’t have to open every module to see what’s inside.</p><h4>Module content</h4><p>But what’s inside a module?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/196/1*gueEvwaw-eUC86QhGEWWYA.png" /></figure><p><strong>Components </strong>folder holds every dumb component you need in that module and that module alone. Separation of concern is key here. You can read more about <a href="https://medium.com/@dan_abramov/smart-and-dumb-components-7ca2f9a7c7d0">here</a>.</p><pre><strong>import </strong>React, { Component } <strong>from </strong>&#39;react&#39;<br><strong>import </strong>Text <strong>from </strong>&#39;../../core/components/Text&#39;<br><strong>import </strong>* <strong>as </strong>colors <strong>from </strong>&#39;material-ui/styles/colors&#39;<br><strong>import </strong>GameTile <strong>from </strong>&#39;./GameTile&#39;</pre><pre><strong>export default class </strong>Games <strong>extends </strong>Component {<br>  render () {<br>    <strong>const </strong>{<br>      mobile<br>    } = <strong>this</strong>.props</pre><pre>    <strong>return </strong>(<br>      &lt;div&gt;<br>        some content<br>      &lt;/div&gt;<br>    )<br>  }<br>}</pre><p><strong>Containers </strong>folder holds the logic. What should be pushed into my dumb components? What data should be fetched (via dispatching actions or redux state)? All those concerns should be stored in here.</p><pre><strong>import </strong>React, { Component } <strong>from </strong>&#39;react&#39;<br><strong>import </strong>{ connect } <strong>from </strong>&#39;react-redux&#39;<br><strong>import </strong>Games <strong>from </strong>&#39;../components/Games&#39;<br><strong>import </strong>{ actions <strong>as </strong>coreActions } <strong>from </strong>&#39;../../core&#39;</pre><pre><strong>class </strong>Container <strong>extends </strong>Component {<br>  componentDidMount () {<br>    <strong>this</strong>.props.dispatch(coreActions.setMenuIndex(1))<br>  }</pre><pre>  render () {<br>    <strong>return </strong>(<br>      &lt;Games<br>        {...<strong>this</strong>.props}<br>      /&gt;<br>    )<br>  }<br>}</pre><pre><strong>export default </strong>connect((state) =&gt; {<br>  <strong>return </strong>{<br>    mobile: state.core.responsive.mobile<br>  }<br>})(Container)</pre><p>As you can see I introduced a “core module” to make shared actions happen. In some point of time you can’t isolate modules completely. Some actions have to be shared and I think that’s a good compromise.</p><p><strong>Routes </strong>folder holds, as the name suggests, all the routes that belong to that module. In this case we have a “/games” route that needs to be hooked to the games container.</p><pre><strong>import </strong>React <strong>from </strong>&#39;react&#39;<br><strong>import </strong>{ Route } <strong>from </strong>&#39;react-router-dom&#39;<br><strong>import </strong>Games <strong>from </strong>&#39;../containers/Games&#39;</pre><pre><strong>export default </strong>(store) =&gt; {<br>  <strong>return </strong>(<br>    &lt;Route exact path=&#39;/games&#39; component={Games}/&gt;<br>  )<br>}</pre><p>Additional routes for example “/games/:id” are also welcome here.</p><h4>Additional folders</h4><p>Actions and reducers also need a place to live.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/230/1*A5k-a00ymYlEl0DEftT4TA.png" /></figure><p><strong>Actions </strong>folder holds the action types for redux calls.</p><pre><strong>export const </strong>MENU_TOGGLE = &#39;MENU_TOGGLE&#39;<br><strong>export const </strong>SET_RESPONSIVE_BREAKPOINT = &#39;SET_RESPONSIVE_BREAKPOINT&#39;<br><strong>export const </strong>SET_MENU_INDEX = &#39;SET_MENU_INDEX&#39;</pre><p>And the actual actions which can be dispatched.</p><pre><strong>import </strong>* <strong>as </strong>TYPES <strong>from </strong>&#39;./actionTypes&#39;</pre><pre><strong>export function </strong>toggleMenu (open) {<br>  <strong>return </strong>{type: TYPES.MENU_TOGGLE, open}<br>}<br><strong>export function </strong>setResponsiveBreakpoint (value) {<br>  <strong>return </strong>{type: TYPES.SET_RESPONSIVE_BREAKPOINT, value}<br>}<br><strong>export function </strong>setMenuIndex (index) {<br>  <strong>return </strong>{type: TYPES.SET_MENU_INDEX, index}<br>}</pre><p><strong>Reducers</strong> folder holds obviously the reducers for that module.</p><pre><strong>import </strong>* <strong>as </strong>TYPES <strong>from </strong>&#39;../actions/actionTypes&#39;</pre><pre><strong>const </strong>defaultState = {<br>  menu: {<br>    open: <strong>false</strong>,<br>    index: -1<br>  },<br>  mobileView: <strong>true</strong>,<br>  responsive: {<br>    mobile: <strong>false</strong>,<br>    tablet: <strong>false</strong>,<br>    desktop: <strong>true<br>  </strong>}<br>}</pre><pre><strong>function </strong>toggleMenu (state, action) {<br>  <strong>return </strong>{<br>    ...state,<br>    menu: {<br>      ...state.menu,<br>      open: <strong>typeof </strong>action.open === &#39;undefined&#39; ? !state.menu.open : action.open<br>    }<br>  }<br>}</pre><pre><strong>function </strong>setMenuIndex (state, action) {<br>  <strong>return </strong>{<br>    ...state,<br>    menu: {<br>      ...state.menu,<br>      index: action.index<br>    }<br>  }<br>}</pre><pre><strong>function </strong>setResponsiveBreakpoint (state, action) {<br>  <strong>return </strong>{<br>    ...state,<br>    responsive: {<br>      mobile: action.value &lt;= 768,<br>      tablet: action.value &gt; 768 &amp;&amp; action.value &lt;= 1200,<br>      desktop: action.value &gt; 1200<br>    }<br>  }<br>}</pre><pre><strong>export default function </strong>(state = defaultState, action) {<br>  <strong>switch </strong>(action.type) {<br>    <strong>case </strong>TYPES.MENU_TOGGLE:<br>      <strong>return </strong>toggleMenu(state, action)<br>    <strong>case </strong>TYPES.SET_RESPONSIVE_BREAKPOINT:<br>      <strong>return </strong>setResponsiveBreakpoint(state, action)<br>    <strong>case </strong>TYPES.SET_MENU_INDEX:<br>      <strong>return </strong>setMenuIndex(state, action)<br>    <strong>default</strong>:<br>      <strong>return </strong>state<br>  }<br>}</pre><p>You can also split this into multiple files if you want.</p><p>And now comes the important part, the glue! After you defined your folders with its logic and visual components you want to expose it, right? That’s where the index.js of the module folder comes in. It collects all the needed parts of the module and expose it for further use. Something like this:</p><pre><strong>import </strong>* <strong>as </strong>actions <strong>from </strong>&#39;./actions&#39;<br><strong>import </strong>reducers <strong>from </strong>&#39;./reducers&#39;<br><strong>import </strong>routes <strong>from </strong>&#39;./routes&#39;</pre><pre><strong>export </strong>{<br>  actions,<br>  reducers,<br>  routes<br>}</pre><p>So everytime you need access to this module you have all the important parts right in the root of the module folder.</p><h3>Make it run</h3><p>So now comes the fun part. After defining our modules we need to deploy them within our application. Let’s take a look back to our overview:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/524/1*oJ9UHmPten6Cca-guXEffg.png" /></figure><p>First let’s combine all the <strong>reducers</strong>. In “src/reducers/index.js” we bundle all the reducers exposed by our modules.</p><pre><strong>export </strong>{ reducer as core } <strong>from </strong>&#39;../modules/core&#39;<br><strong>export </strong>{ reducer as games } <strong>from </strong>&#39;../modules/games&#39;<br><strong>export </strong>{ reducer as anotherModule } <strong>from </strong>&#39;../modules/anotherModule&#39;</pre><p>This can be later used to combine our store just with:</p><pre><strong>import </strong>* <strong>as </strong>reducers <strong>from </strong>&#39;../reducers&#39;</pre><p>And all our reducers from all defined modules are ready to go. Neat!</p><p>Same goes for the <strong>routes</strong>. Take a look inside the AppRoutes.js content:</p><pre><strong>import </strong>React <strong>from </strong>&#39;react&#39;<br><strong>import </strong>{ Switch } <strong>from </strong>&#39;react-router-dom&#39;</pre><pre><strong>import </strong>Application <strong>from </strong>&#39;./modules/core/containers/Application&#39;<br><strong>import </strong>{ routes <strong>as </strong>home } <strong>from </strong>&#39;./modules/home&#39;<br><strong>import </strong>{ routes <strong>as </strong>games } <strong>from </strong>&#39;./modules/games&#39;<br><strong>import </strong>{ routes <strong>as </strong>team } <strong>from </strong>&#39;./modules/team&#39;<br><strong>import </strong>{ routes <strong>as </strong>contact } <strong>from </strong>&#39;./modules/contact&#39;<br><strong>import </strong>{ routes <strong>as </strong>impressum } <strong>from </strong>&#39;./modules/impressum&#39;</pre><pre><strong>export default </strong>(store) =&gt; {<br>  <strong>return </strong>(<br>    &lt;Switch&gt;<br>      &lt;Application&gt;<br>        {home(store)}<br>        {games(store)}<br>        {team(store)}<br>        {contact(store)}<br>        {impressum(store)}<br>      &lt;/Application&gt;<br>    &lt;/Switch&gt;<br>  )<br>}</pre><p>This file just exposed all routes defined in our modules. They are embedded in an shared Application component defined in the core module. Application is the wrapper with header and footer and takes children as prop.</p><p>Now just import those routes in your Root.js and everything is ready to deploy.</p><pre><strong>import </strong>React <strong>from </strong>&#39;react&#39;<br><strong>import </strong>{ Provider } <strong>from </strong>&#39;react-redux&#39;<br><strong>import </strong>* <strong>as </strong>OfflinePluginRuntime <strong>from </strong>&#39;offline-plugin/runtime&#39;</pre><pre><strong>import </strong>configureStore <strong>from </strong>&#39;./configs/configureStore&#39;<br><strong>import </strong>createRoutes <strong>from </strong>&#39;./AppRoutes&#39;</pre><pre><strong>import </strong>createHistory <strong>from </strong>&#39;history/createBrowserHistory&#39;<br><strong>import </strong>{ ConnectedRouter } <strong>from </strong>&#39;react-router-redux&#39;</pre><pre><strong>import </strong>MuiThemeProvider <strong>from </strong>&#39;material-ui/styles/MuiThemeProvider&#39;<br><strong>import </strong>getMuiTheme <strong>from </strong>&#39;material-ui/styles/getMuiTheme&#39;<br><strong>import </strong>theme <strong>from </strong>&#39;./theme&#39;</pre><pre><strong>import </strong>&#39;./main.less&#39;</pre><pre><strong>const </strong>history = createHistory()</pre><pre><strong>const </strong>store = configureStore({}, history)</pre><pre>OfflinePluginRuntime.install()</pre><pre><strong>export default </strong>() =&gt; (<br>  &lt;Provider store={store}&gt;<br>    &lt;MuiThemeProvider muiTheme={getMuiTheme(theme)}&gt;<br>      &lt;ConnectedRouter history={history}&gt;<br>        {createRoutes(store)}<br>      &lt;/ConnectedRouter&gt;<br>    &lt;/MuiThemeProvider&gt;<br>  &lt;/Provider&gt;<br>)</pre><h3>Conclusion</h3><p>We now have several modules that are <strong>isolated</strong> from each other. That makes them <strong>easy to swap</strong> out for others. Also <strong>import statements</strong> are now extremely short. Further changes inside a module make <strong>distraction</strong> while coding from another module obsolete. <strong>Maintainability </strong>is far better than searching for files associated with a specific concern. It <strong>scales well</strong> due to just a few glue points needed and <strong>less clutter</strong> inside the modules folder.</p><h3>Supplement</h3><p>I wrote a npm package to hide most of the preparations needed to use this structure and do most of this behind the curtain.</p><p><a href="https://github.com/TeamWertarbyte/module-loader">TeamWertarbyte/module-loader</a></p><p>It’s still in an early stage an every PR and comment is welcome. But I already use this in production so I’m pretty confident that this will work as intended.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3a831ffd1580" width="1" height="1" alt=""><hr><p><a href="https://medium.com/wertarbyte/structure-your-react-apps-the-mantra-way-3a831ffd1580">Structure your react apps the mantra way</a> was originally published in <a href="https://medium.com/wertarbyte">Wertarbyte</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>