<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Darko</title>
    <description>The latest articles on DEV Community by Darko (@darkokolev).</description>
    <link>https://dev.to/darkokolev</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F132851%2F3b9538d9-3875-44f9-a238-35542c5d5b43.jpg</url>
      <title>DEV Community: Darko</title>
      <link>https://dev.to/darkokolev</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/darkokolev"/>
    <language>en</language>
    <item>
      <title>How to detect weekly crypto winners</title>
      <dc:creator>Darko</dc:creator>
      <pubDate>Mon, 01 Jun 2020 13:37:31 +0000</pubDate>
      <link>https://dev.to/darkokolev/how-to-detect-weekly-crypto-winners-464g</link>
      <guid>https://dev.to/darkokolev/how-to-detect-weekly-crypto-winners-464g</guid>
      <description>&lt;p&gt;In this article we’ll go over a few scenarios and code examples about how to track the biggest winners within the crypto market in a short period, a week or a month.&lt;/p&gt;

&lt;p&gt;You can inspect the coins you are actively trading in, you can explore among the different Bitcoin markets or you can track the top 20 coins by marketcap.&lt;/p&gt;

&lt;p&gt;Using the BitcoinAverage API all of these scenarios can be easily achieved.&lt;/p&gt;

&lt;p&gt;We will define crypto winners in few categories:&lt;/p&gt;

&lt;p&gt;Highest relative price increase, in percents.&lt;br&gt;
Highest absolute price increase, in us dollars.&lt;br&gt;
Highest market cap increase.&lt;br&gt;
Highest 24h trading volume increase.&lt;/p&gt;
&lt;h2&gt;
  
  
  Highest price increase
&lt;/h2&gt;

&lt;p&gt;To calculate the highest price increase we need to fetch both the latest ticker price and the historical price that we are interested in.&lt;/p&gt;

&lt;p&gt;My list of coins will be: Bitcoin(BTC), Ethereum(ETH), Litecoin(LTC), Ripple(XRP) and Monero(XMR).&lt;/p&gt;
&lt;h2&gt;
  
  
  Latest ticker price
&lt;/h2&gt;

&lt;p&gt;The latest ticker price for one coin can be retrieved from the BitcoinAverage ticker endpoint: &lt;a href="https://apiv2.bitcoinaverage.com/indices/global/ticker/BTCUSD" rel="noopener noreferrer"&gt;https://apiv2.bitcoinaverage.com/indices/global/ticker/BTCUSD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;This is the global Bitcoin price calculated by averaging all Bitcoin trading markets, including BTC/USD, BTC/EUR, BTC/GBP etc..&lt;/p&gt;

&lt;p&gt;If you are interested only in the BTC/USD market, you can get that with our local ticker endpoint: &lt;a href="https://apiv2.bitcoinaverage.com/indices/local/ticker/BTCUSD" rel="noopener noreferrer"&gt;https://apiv2.bitcoinaverage.com/indices/local/ticker/BTCUSD&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;In our case we want to get ticker price for 5 coins at once, we can do that with the “all” endpoint: &lt;a href="https://apiv2.bitcoinaverage.com/indices/global/ticker/all" rel="noopener noreferrer"&gt;https://apiv2.bitcoinaverage.com/indices/global/ticker/all&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Here is a code in Python on how to get these prices:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;You will receive a lot more data than you need to, this is the full ticker response for one coin, you will receive a dictionary or a map of these, represented like: {BTCUSD: {ticker response}, ETHUSD: {ticker response}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbitcoinaverage.com%2Fblog%2Fwp-content%2Fuploads%2F2020%2F05%2FScreen-Shot-2020-05-20-at-14.40.44.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbitcoinaverage.com%2Fblog%2Fwp-content%2Fuploads%2F2020%2F05%2FScreen-Shot-2020-05-20-at-14.40.44.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see we already keep track of the price changes for hour, day, week, month, 3 months, 6 months and year periods. But with this tutorial you can track the price changes for a specific period of your choosing.&lt;/p&gt;

&lt;p&gt;From the ticker response we will be using only the “last” price and the volume.&lt;/p&gt;

&lt;h2&gt;
  
  
  History price and circulating supply
&lt;/h2&gt;

&lt;p&gt;We can retrieve the history price at a single point in time or in a time period.&lt;/p&gt;

&lt;p&gt;For our example we’ll be getting the price at a single point in time, 7 days ago from today.&lt;/p&gt;

&lt;p&gt;The History endpoint we’ll be using is:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://apiv2.bitcoinaverage.com/indices/global/history/BTCUSD?at=timestamp" rel="noopener noreferrer"&gt;https://apiv2.bitcoinaverage.com/indices/global/history/BTCUSD?at=timestamp&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The actual code:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;Here we must make a separate call for every coin and the response will be as bellow.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbitcoinaverage.com%2Fblog%2Fwp-content%2Fuploads%2F2020%2F05%2FScreen-Shot-2020-05-22-at-12.19.47.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fbitcoinaverage.com%2Fblog%2Fwp-content%2Fuploads%2F2020%2F05%2FScreen-Shot-2020-05-22-at-12.19.47.png"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;As you can see we have the full OHLCV response here for May 15th. Today we are going to use only the average price and the volume.&lt;/p&gt;

&lt;p&gt;You will notice a second function called get_coin_supplies. We use this one to get the metadata that contains the market cap, total supply and circulating supply. We will use the circulating supply to detect which coin had the biggest market cap movement.&lt;/p&gt;

&lt;p&gt;Our calculation for market cap will simply multiply the price by the circulating supply.&lt;/p&gt;

&lt;h2&gt;
  
  
  Calculating and sorting winners
&lt;/h2&gt;

&lt;p&gt;Once we have all the data we need we can write the algorithm for calculating the price, volume and market cap changes and sort the results.&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


&lt;p&gt;For calculating the price difference we just subtract the latest ticker price from the history price. We do the same thing for the volume.&lt;/p&gt;

&lt;p&gt;For the market cap difference we multiply the circulating supply by the same price difference.&lt;/p&gt;

&lt;p&gt;Finally we are sorting by the absolute price difference by specifying the key argument to the sort function with operator.itemgetter(1)&lt;/p&gt;

&lt;p&gt;If you’d like to sort by relative price, set operator.itemgetter(2), to sort by volume pass in operator.itemgetter(3) and by market cap operator.itemgetter(4).&lt;/p&gt;

&lt;p&gt;If you find this useful or interesting let us know in the comments.&lt;/p&gt;

&lt;p&gt;If you have other ideas you’d like to implement with live and historical crypto data you can contact us at &lt;a href="mailto:info@bitcoinaverage.com"&gt;info@bitcoinaverage.com&lt;/a&gt; and we’ll be happy to help.&lt;/p&gt;

</description>
      <category>cryptocurrency</category>
      <category>bitcoin</category>
      <category>dev</category>
      <category>development</category>
    </item>
    <item>
      <title>Efficient way to calculate a moving average</title>
      <dc:creator>Darko</dc:creator>
      <pubDate>Mon, 18 May 2020 08:55:26 +0000</pubDate>
      <link>https://dev.to/darkokolev/efficient-way-to-calculate-a-moving-average-1amp</link>
      <guid>https://dev.to/darkokolev/efficient-way-to-calculate-a-moving-average-1amp</guid>
      <description>&lt;p&gt;The moving average figure is part of the most popular trading indicators. It provide reliable and important information about the state of the market we are tracking.&lt;/p&gt;

&lt;h2&gt;
  
  
  Benefits of moving averages
&lt;/h2&gt;

&lt;p&gt;Instead of tracking the price movement only by the latest price, which is only one point, the moving average is tracking the average movement in a full period, taking into consideration the last n points.&lt;/p&gt;

&lt;p&gt;If you’re calculating daily average, that is the average price movement in the last 24 hours, this is taking into consideration all price points from the last 24 hours.&lt;br&gt;
This makes the moving average a more reliable indicator of the price movement that is not easily swayed by one or two trades.&lt;/p&gt;
&lt;h2&gt;
  
  
  Usages
&lt;/h2&gt;

&lt;p&gt;The moving average is part of many trading strategies. One of the most common signals is tracking two distinct moving average windows and detecting the points of their interceptions.&lt;/p&gt;

&lt;p&gt;For example tracking the short 5 days and the long 30 days averages. When the short moving average crosses the long moving average that indicates these is real price movement in the market.&lt;/p&gt;

&lt;p&gt;Calculating Moving Average&lt;br&gt;
Example: Let’s consider having the following 5 prices, one per day, that we want to calculate moving average.&lt;/p&gt;

&lt;p&gt;Day1: 5000&lt;br&gt;
Day2: 5390&lt;br&gt;
Day3: 5500&lt;br&gt;
Day4: 5400&lt;br&gt;
Day5: 5700&lt;/p&gt;

&lt;p&gt;If we are calculating moving average with size of 5, we would calculate the average from all 5 days from above:&lt;br&gt;
Sum = 5000 + 5390 + 5500 + 5400 + 5700 = 25000&lt;br&gt;
Count = 5&lt;br&gt;
Moving average = 25000 / 5 = 5000&lt;/p&gt;

&lt;p&gt;When we receive a price for Day6 we would need to sum the day prices between Day2 and Day6 and again divide by 5 to keep the moving average moving forward.&lt;/p&gt;
&lt;h2&gt;
  
  
  The Efficient approach
&lt;/h2&gt;

&lt;p&gt;At BitcoinAverage we are keeping moving averages from 24h up to 1 full year. In this case we have a lot of price points to sum up which is quite inefficient considering that only few price points come in and few expire.&lt;/p&gt;

&lt;p&gt;There is also another challenge which is that sometimes there could be 5 new price point per calculation and other times 10, so the count of the numbers need to be adjusted as well.&lt;/p&gt;

&lt;p&gt;The approach we came up with is the following:&lt;/p&gt;

&lt;p&gt;Keep a moving sum and moving count of all price points&lt;br&gt;
When new price points arrive, update the sum and the counter&lt;br&gt;
When price points expire, remove them from sum and decrease counter&lt;br&gt;
To calculate the average just divide the moving sum by the moving counter.&lt;/p&gt;
&lt;h2&gt;
  
  
  Example
&lt;/h2&gt;

&lt;p&gt;Let’s start with the price points: 5001, 5002, 5003, 5004.&lt;/p&gt;

&lt;p&gt;We keep the sum and the count of these numbers:&lt;/p&gt;

&lt;p&gt;Sum = 20010&lt;/p&gt;

&lt;p&gt;Count = 4&lt;/p&gt;

&lt;p&gt;Then we receive two new numbers: 5010 and 5008, now are full list looks like this:&lt;/p&gt;

&lt;p&gt;5001, 5002, 5003, 5004, 5010, 5008.&lt;/p&gt;

&lt;p&gt;If we are keeping a moving average based on the number of price points, in this case 4, then we need to include the two new numbers and remove the two oldest ones.&lt;/p&gt;

&lt;p&gt;What we do is just subtract from the sum the expired ones and add in the new ones.&lt;/p&gt;

&lt;p&gt;Sum = 20010 – 5001 – 5002 + 5010 + 5008 = 2025&lt;/p&gt;

&lt;p&gt;The counter stays the same, 4.&lt;/p&gt;

&lt;p&gt;However most often you will need to keep a moving average based on a time window, for example 24hours. And you will be calculating the average on a different interval than the prices are ariving.&lt;/p&gt;

&lt;p&gt;For example new price points could be arriving every second, but the average will be recalculated every minute. This is the case with any trading market, there are new prices every second.&lt;/p&gt;

&lt;p&gt;So at the point of updating the moving average you could have 15 new prices and only 12 expiring prices, which would alter your counter value.&lt;/p&gt;

&lt;p&gt;The first thing to do is to keep your price points sorted by their time of arrival, the easiest format to keep track of arrival time is by timestamp,&lt;/p&gt;

&lt;p&gt;Timestamp for a specific date is a number that represents the number of seconds passed since 1970 until that date and time.&lt;/p&gt;

&lt;p&gt;Without further due here is a complete gist example in Python:&lt;/p&gt;


&lt;div class="ltag_gist-liquid-tag"&gt;
  
&lt;/div&gt;


</description>
      <category>movingaverage</category>
      <category>development</category>
      <category>cryptocurrency</category>
      <category>webdev</category>
    </item>
    <item>
      <title>FocusHub | Productivity Social Network for the greater good</title>
      <dc:creator>Darko</dc:creator>
      <pubDate>Fri, 08 May 2020 04:18:16 +0000</pubDate>
      <link>https://dev.to/darkokolev/focushub-productivity-social-network-for-the-greater-good-191j</link>
      <guid>https://dev.to/darkokolev/focushub-productivity-social-network-for-the-greater-good-191j</guid>
      <description>&lt;p&gt;Wouldn’t it be fun if we could socialize, have fun, connect with our friends or meet new friends around our interests and experience awesome productivity at the same time?&lt;/p&gt;

&lt;p&gt;Of course it would be. But the social networks out there are designed to turn you into a consumer zombie, grab your attention and keep it as long as possible. Scrolling mindlessly through the endless stream of videos, pictures, stories, tweets, pins…&lt;/p&gt;

&lt;p&gt;There is a much greater opportunity here. We are social beings, that’s a fact and that is great. That is how we survived for thousands of years, in tribes, by staying connected and getting better together.&lt;/p&gt;

&lt;p&gt;That is the true power of social networks.&lt;/p&gt;

&lt;p&gt;And we can use it to our advantage.&lt;/p&gt;

&lt;h2&gt;
  
  
  The purpose of Focus Hub
&lt;/h2&gt;

&lt;p&gt;What if there is a social network that helps us achieve more, be more productive and create better lives for ourselves?&lt;/p&gt;

&lt;p&gt;What about a social network where instead of posting pictures of your food everyone shares what they’ve accomplished today.&lt;/p&gt;

&lt;p&gt;What if you could work alongside other like-minded people who are focused on making it in life and achieving their goals.&lt;/p&gt;

&lt;p&gt;FocusHub is a social network that provides an environment that encourages productivity and it provides the tools for getting into Flow and getting things done with efficiency.&lt;/p&gt;

&lt;h2&gt;
  
  
  Environment
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--No08HugE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://focusmind.blog/wp-content/uploads/2020/04/fh-social-full-2048x1112.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--No08HugE--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://focusmind.blog/wp-content/uploads/2020/04/fh-social-full-2048x1112.png" alt="productivity feed"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The Productivity feed at FocusHub allows you to share your major and minor daily accomplishments and completed tasks. Place to share your small daily wins and participate in a friendly competition with the daily scoreboard of minutes worked and tasks accomplished.&lt;/p&gt;

&lt;p&gt;Imagine you are hanging out with bakers all day, people making bread. In a while you’ll know quite a lot about making bread.&lt;/p&gt;

&lt;p&gt;At FocusHub you’re around people interested in productivity, high performance and achievement, just by being there, the productivity will rub off.&lt;/p&gt;

&lt;h3&gt;
  
  
  Focus Sessions: strategy for maximum efficiency and flow
&lt;/h3&gt;

&lt;p&gt;Focus Sessions make FocusHub a hybrid between a social network and a productivity tool.&lt;br&gt;
They help you actually get things done and get into flow more easily. Focus sessions allow you to create customizable work cycles with short breaks in-between.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--7UJ2s9Ep--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://focusmind.blog/wp-content/uploads/2020/04/fh-session-work-dark-2.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--7UJ2s9Ep--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://focusmind.blog/wp-content/uploads/2020/04/fh-session-work-dark-2.png" alt="focus sessions"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;For every work cycle you have to define three things:&lt;/p&gt;

&lt;p&gt;The task to accomplish&lt;br&gt;
First concrete steps on how to get started with the task&lt;br&gt;
Anticipate blockers&lt;br&gt;
Defining all of these, combined with the time limit will force you to laser focus and achieve much more in that time period.&lt;br&gt;
Also knowing you have a break afterwards will allow you to put off any distractions, emails, phone calls and get to them as soon as your cycle is over. Anything can wait a few minutes.&lt;/p&gt;

&lt;p&gt;I usually work in 30min work with 5min breaks work intervals for normal tasks and 50min work with 10min breaks for deep work in the morning.&lt;/p&gt;

&lt;p&gt;You can explore FocusHub at: &lt;a href="https://thefocushub.net"&gt;https://thefocushub.net&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;See you on the productive side.&lt;/p&gt;

&lt;p&gt;PS: You can reach me at &lt;a href="mailto:darko@thefocushub.net"&gt;darko@thefocushub.net&lt;/a&gt; for any suggestions, bug reports, questions or productivity advice.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>socialnetwork</category>
      <category>webdev</category>
      <category>work</category>
    </item>
    <item>
      <title>Project management sprinkled with productivity and a dash of self-improvement</title>
      <dc:creator>Darko</dc:creator>
      <pubDate>Thu, 25 Apr 2019 13:16:35 +0000</pubDate>
      <link>https://dev.to/darkokolev/project-management-sprinkled-with-productivity-and-a-dash-of-self-improvement-1fi1</link>
      <guid>https://dev.to/darkokolev/project-management-sprinkled-with-productivity-and-a-dash-of-self-improvement-1fi1</guid>
      <description>&lt;h3&gt;
  
  
  The vision of combining project management with productivity and self improvement.
&lt;/h3&gt;

&lt;h2&gt;
  
  
  Self improvement: Become more capable to do the work
&lt;/h2&gt;

&lt;p&gt;&lt;em&gt;Habits:&lt;/em&gt; Adopt healthy habits to have more energy, healthier body and mind that can accomplish more in less time&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--KgZKvEum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.lifehqapp.com/wp-content/uploads/2019/04/intro-journal-normal.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--KgZKvEum--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.lifehqapp.com/wp-content/uploads/2019/04/intro-journal-normal.jpg" alt="LifeHQ Journal"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Journaling:&lt;/em&gt; is only helpful if you do it consistently. Record your daily activities, the parts that matter to you at least, and then review your daily journals every week into your weekly journal.&lt;br&gt;
This is the fastest way to detect if you are spinning your wheels being busy and not going anywhere or you are on the right path. If moving forward, notice if it's the right direction and course correct if needed.&lt;/p&gt;

&lt;h2&gt;
  
  
  Project management: Organize the work
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--ruUWf85Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.lifehqapp.com/wp-content/uploads/2019/04/intro-project-overview.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--ruUWf85Y--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.lifehqapp.com/wp-content/uploads/2019/04/intro-project-overview.jpg" alt="LifeHQ project management"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Everything can be set as a project, losing weight, building a business, starting a podcast, organizing an event.&lt;br&gt;
Any goal that you have, once you make it concrete, becomes a project.&lt;br&gt;
Organize your goals into projects with specific tasks, deadlines and documents.&lt;/p&gt;

&lt;p&gt;Use the master list every night to plan the tasks for the next day.&lt;/p&gt;

&lt;h2&gt;
  
  
  Productivity: Do the work, more focused and productive
&lt;/h2&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--9YtglrJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.lifehqapp.com/wp-content/uploads/2019/04/intro-work.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--9YtglrJP--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://blog.lifehqapp.com/wp-content/uploads/2019/04/intro-work.jpg" alt="LifeHQ productivity"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Use the advanced pomodoro cycles to work in small focused work periods. Smaller periods are easier to guard against distractions and to get focused.&lt;/p&gt;

&lt;h2&gt;
  
  
  Who is it for
&lt;/h2&gt;

&lt;p&gt;Obviously anyone can benefit from becoming better, getting organized and working faster.&lt;/p&gt;

&lt;p&gt;But not everyone will do that. Some people are lazy and others can’t get out of their current routine. Others already have a system that’s working for them and that is also fine. It is important to know who your product is not for as well.&lt;/p&gt;

&lt;h3&gt;
  
  
  Two groups of people will benefit the most out of LifeHQ
&lt;/h3&gt;

&lt;h4&gt;
  
  
  Group 1: You have a system but it’s broken
&lt;/h4&gt;

&lt;p&gt;Usually the ones that already have a system are people who know that productivity, organization matters and they have things going on in their lives.&lt;/p&gt;

&lt;h4&gt;
  
  
  Entrepreneurs and Freelancers
&lt;/h4&gt;

&lt;p&gt;People working for themselves and trying to get their business off the ground.&lt;/p&gt;

&lt;p&gt;They have tried a lot of productivity apps and tried to combine them into a system for managing their lives.&lt;/p&gt;

&lt;p&gt;Probably have 3 or 4 different apps but end up using only the ones they have to, the ones with the actual work. All the habits, journals and pomodoro apps are forgotten after a few days, because they are nice-to-haves not must-haves.&lt;/p&gt;

&lt;p&gt;LifeHQ solves this problem by luring you in with the project management module but once you’re there it is so easy to write your journal, check off your habits and spin a few work cycles.&lt;/p&gt;

&lt;h4&gt;
  
  
  Group 2: No system whatsoever
&lt;/h4&gt;

&lt;p&gt;In this group I will put students but also anyone that is in a new environment and wants to prove him or herself.&lt;/p&gt;

&lt;p&gt;Students at the beginning of their studies need to prove themselves in College or University.&lt;/p&gt;

&lt;p&gt;Students at the end of their studies beginning their first job must prove themselves in the new workplace.&lt;/p&gt;

&lt;p&gt;They will understand LifeHQ much easier because they have no previous bad patterns and experiences with productivity systems.&lt;/p&gt;

&lt;h2&gt;
  
  
  Proactive software
&lt;/h2&gt;

&lt;p&gt;Proactive software goes beyond mere functionality.&lt;br&gt;
It helps you become a power user as quickly as possible.&lt;br&gt;
As a result you get the benefits that you signed up for much sooner: productivity, organization and consistency.&lt;/p&gt;

&lt;h3&gt;
  
  
  How LifeHQ is proactive
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;LifeHQ is built as an out of the box system ready for use in 2 minutes.&lt;/li&gt;
&lt;li&gt;All 4 types of journals have different templates so you are never caught staring at a blank screen not knowing what to write.&lt;/li&gt;
&lt;li&gt;LifeHQ knows what you need to accomplish today and offers morning, midday and evening reminders that notify you what is left for the day.&lt;/li&gt;
&lt;li&gt;When you login for the first time you already have a project created with real tasks for personalizing your system with your goals, projects and habits.&lt;/li&gt;
&lt;li&gt;Introductory tours: All modules have introductory tour that explain everything you see on every page.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;To skyrocket your productivity, finish your projects and simply accomplish more try out &lt;a href="http://lifehqapp.com"&gt;LifeHQ&lt;/a&gt; for free.&lt;/p&gt;

</description>
      <category>productivity</category>
      <category>projectmanagement</category>
      <category>organization</category>
    </item>
    <item>
      <title>The easiest way to track your Bitcoin profits</title>
      <dc:creator>Darko</dc:creator>
      <pubDate>Tue, 23 Apr 2019 10:50:42 +0000</pubDate>
      <link>https://dev.to/darkokolev/the-easiest-way-to-track-your-bitcoin-profits-39i2</link>
      <guid>https://dev.to/darkokolev/the-easiest-way-to-track-your-bitcoin-profits-39i2</guid>
      <description>&lt;p&gt;We often find ourselves checking the bitcoin price multiple times a day, waiting for the next peak or valley. We all want to make some profit from the market volatility.&lt;/p&gt;

&lt;p&gt;Often times this becomes distracting and time consuming, but not anymore. Let's build a script which automatically checks the price at your favorite exchange, compares it to your starting price and notifies you of the profit you are making.&lt;/p&gt;

&lt;h2&gt;
  
  
  Quick Start Guide
&lt;/h2&gt;

&lt;p&gt;If you just want to run the script without digging into it you can get the final code from &lt;a href="https://gist.github.com/KolevDarko/e4e57825871c89adfaf0bf09eded3b45"&gt;here&lt;/a&gt;. Then just copy and paste it into a file with “.py” extension and run it via terminal:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;$ python bitcoin-profits.py
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The script will prompt you to enter some data.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Your exchange: the exchange you want to check at, this is the exchange where you plan to sell the bitcoin eventually, or just your favorite one.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitcoin starting price: The price at which you bought your coins.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Bitcoin amount: The amount of bitcoin you bought at that price.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Your currency (default USD): The fiat currency in which you are trading.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Check every (seconds): The script performs the calculation in an infinite loop, so this parameter specifies how much to wait between subsequent executions. You can choose from 4 options for our API.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Choose to be notified when a certain limit is reached: 1) Percent limit, 2) Amount limit. Here you specify when you want to be notified of the change in price in Bitcoin. If you choose the first option (1), then you will be asked to enter the amount of percent. Say you enter 10, this means that when the price of Bitcoin changes 10% from your starting price, you will receive a notification. The second option allows you to specify the exact amount, here if you enter 10 you will be notified when the Bitcoin price deviates 10 US dollars form the starting price (assuming US dollars is your currency).&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;h2&gt;
  
  
  Full Developer guide
&lt;/h2&gt;

&lt;h3&gt;
  
  
  Step 1: Generating the BitcoinAverage API key pair
&lt;/h3&gt;

&lt;p&gt;To be able to generate a key pair you must have an account at BitcoinAverage. &lt;a href="https://bitcoinaverage.com/en/plans"&gt;Choose one here&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;After you create and verify your account you can generate the API key pair &lt;a href="https://bitcoinaverage.com/en/apikeys"&gt;here.&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;We have a complicated authentication method and a simple one. &lt;br&gt;
Let's use the simpler one here. Just copy the public key and put it in a header in your request.&lt;br&gt;
Header&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;x-ba-key: &amp;lt;your public key here&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Step 2: Making the Http API call to the BitcoinAverage API
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def main(exchange, starting_price, amount, currency, limit_type, limit):
    """
    :param exchange: The exchange where bitcoin was bought
    :param starting_price: The price at which bitcoin was bought
    :param amount: The amount of bitcoin
    :param currency: The currency bitcoin was bought in
    :param limit_type: The type of threshold, percent or amount
    :param limit: The value of the threshold
    :return: Current profit made
    """

    API_ROOT = "https://apiv2.bitcoinaverage.com"

    response = requests.get("{api}/exchanges/{exchange}".format(api=API_ROOT, exchange=exchange), headers={'x-ba-key': &amp;lt;your public key here&amp;gt;})
    symbol = 'BTC'+currency
    latest_bid = response.json()['symbols'][symbol]['bid']
    result = calculate_profits(currency, latest_bid, starting_price, amount, limit_type, limit)
    return result
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is the main function that accepts all of the parameters entered by the user and forwards them to the calculate_profits function which we’ll write next.&lt;/p&gt;

&lt;p&gt;But before we start coding make sure you have the awesome requests http library installed. Get it with: pip install requests.&lt;/p&gt;

&lt;p&gt;Let’s checkout the response we get from our API real quick.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;
{
    "name": "bitstamp",
    "display_name": "Bitstamp",
    "url": "https://bitstamp.net/",
    "timestamp": 1493816831,
    "data_source": "api",
    "symbols": {
        "XRPEUR": {
            "last": 0.0513,
            "volume": 5706005.4795,
            "ask": 0.0513,
            "bid": 0.0511
        },
        "BTCUSD": {
            "last": 1474.74,
            "volume": 9207.05,
            "ask": 1474.70,
            "bid": 1471.81
        },
        "BTCEUR": {
            "last": 1345.10,
            "volume": 1032.09,
            "ask": 1347.59,
            "bid": 1345.10
        },
        "XRPUSD": {
            "last": 0.0560,
            "volume": 12515723.6935,
            "ask": 0.0560,
            "bid": 0.0557
        }
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;As you see from this response you can discover all the available trading pairs at your exchange and you can extend this script to perform the profits check calculation on more than one trading pair.&lt;/p&gt;

&lt;p&gt;For now we will only use the BTCUSD values from the response. &lt;br&gt;
Let’s cover what these values mean: ask, bid, last and volume.&lt;/p&gt;

&lt;p&gt;Last: the last price at which Bitcoin was sold or bought&lt;br&gt;
Bid: the best (highest) bid. The highest price someone is willing to buy Bitcoin at your exchange right now.&lt;br&gt;
Ask: the best (lowest) ask. The lowest price someone is willing to sell Bitcoin at your exchange right now.&lt;br&gt;
Volume: the total number of Bitcoin bought and sold at this exchange in the last 24 hours.&lt;/p&gt;

&lt;p&gt;From these values we are only interested in the “bid” value because if we were to sell our coins right now, that is the price we would get for them. so after we extract the bid, we just pass all the values to the calculate_profits function.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 3: Algorithm for checking our profits
&lt;/h3&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;def calc_percent_diff(now, base):
    difference = now - base
    return difference * 100 / base

def calculate_profits(cc, latest_bid, starting_price, amount, limit_type, limit):
    difference = abs((latest_bid - starting_price) * amount)
    single_diff = latest_bid - starting_price
    if limit_type == 'percent':
        percent_difference = calc_percent_diff(latest_bid, starting_price)
        if percent_difference &amp;gt;= limit:
            return "The bitcoin price has increased by {:.2f} %, you have a profit of {:.2f} {}\n That is {:.2f} {} per coin.".format(percent_difference, difference, cc, abs(single_diff), cc)
        elif percent_difference &amp;lt;= -1 * limit:
            return "The bitcoin price has decreased by {:.2f} %, you have a loss of {:.2f} {}\n That is {:.2f} {} per coin.".format(abs(percent_difference), difference, cc, abs(single_diff), cc)
    else:
        if single_diff &amp;gt;= limit:
            return "The bitcoin price has increased by {:.2f} {}, you have a profit of {:.2f} {}\n That is {:.2f} {} per coin.".format(single_diff, cc, difference, cc, abs(single_diff), cc)
        elif single_diff &amp;lt;= -1 * limit:
            return "The bitcoin price has decreased by {:.2f} {}, you have a loss of {:.2f} {}\n That is {:.2f} {} per coin.".format(single_diff, cc, abs(difference), cc, abs(single_diff), cc)
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;What we are doing here is comparing the starting price with the latest bid price we got from the API.&lt;/p&gt;

&lt;p&gt;If the script is setup to check in percent, we are doing that, otherwise we are checking for the absolute difference in dollars between the two prices.&lt;/p&gt;

&lt;p&gt;If the latest price has deviated from the starting price more than a certain amount then we are constructing a helpful message that we will present to the end user.&lt;/p&gt;
&lt;h3&gt;
  
  
  Step 4: Running the script in an infinite loop and displaying desktop notifications on Linux and Mac
&lt;/h3&gt;


&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if __name__ == '__main__':
    my_exchange = input("Your exchange:")
    starting_price = input("Bitcoin starting price:")
    amount = input("Bitcoin amount:")
    currency = input("Your currency (default USD):")
    check_every = input("Check every (seconds):")
    threshold = input("Choose to be notified when a certain limit is reached\n1) Percent limit: \n2) Amount limit: \n ")
    limit_type = None
    limit = 0
    if threshold == '1':
        limit_type = 'percent'
        limit = input("Percent:")
    elif threshold == '2':
        limit_type = 'amount'
        limit = input("Amount:")
    if not currency:
        currency = 'USD'
    notifications = input("Choose desktop notifications: \n0) No\n1) Mac\n2) Linux\n")
    while True:
        result = main(my_exchange, float(starting_price), float(amount), currency, limit_type, float(limit))
        if result:
            if notifications == '1':
                content = 'display notification "{result}" with title "Bitcoin Profits" '.format(result=result)
                subprocess.run(['/usr/bin/osascript', '-e', content])
            elif notifications == '2':
                subprocess.run(['notify-send', 'Bitcoin Profits', result])
            else:
                print(result)
            break
        time.sleep(int(check_every))
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;


&lt;p&gt;First we’re getting all the data we need from the user and then using infinite looping (while True:) we are executing the main function from before.&lt;br&gt;
If this function happens to return us some answer, that means there is something to show to the user.&lt;/p&gt;

&lt;p&gt;Depending on his choosing either Linux or Mac desktop notification will be generated. If he hasn’t chosen notifications, or is a Windows user, the message will be printed in the terminal.&lt;/p&gt;
&lt;h3&gt;
  
  
  Linux desktop notifications
&lt;/h3&gt;

&lt;p&gt;I have only tried this on Ubuntu Linux, so these might not work on other Linux distributions. The library for generating notifications is called notify-send and it’s very simple to use. In our example above I am running it like this.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;notify-send 'Bitcoin Profits' result
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This will show the result as the body of the notification and “Bitcoin Profits” as the title.&lt;/p&gt;

&lt;h3&gt;
  
  
  Mac desktop notifications
&lt;/h3&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;osascript -e 'display notification "You have made 10% profit" with title "Bitcoin profits" '
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Full code
&lt;/h3&gt;

&lt;p&gt;The full code for the script can be found here: &lt;a href="https://gist.github.com/KolevDarko/e4e57825871c89adfaf0bf09eded3b45"&gt;https://gist.github.com/KolevDarko/e4e57825871c89adfaf0bf09eded3b45&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If you have any questions about extending this script or doing something similar feel free to ask in the comments.&lt;/p&gt;

</description>
      <category>crypto</category>
      <category>bitcoin</category>
      <category>scripts</category>
      <category>python</category>
    </item>
  </channel>
</rss>
