Coinguide Update: Code Refactoring in progress, About, Privacy Policy and FAQs Page now available.

in utopian-io •  6 years ago  (edited)

Coinguide Update: Code Refactoring in progress, About, Privacy Policy and FAQs Page now available.



coinlogo.png

Project Overview

COINGUIDE : a webapp that aims to guide crypto traders on the most popular Cryptocurrencies. It achieves this by fetching records from poloniex using their api, rating these records according to their buy orders.

Coinguide aims to keep traders informed about the popular coins (coins which the highest number of buy orders within a specific time range). A future goal of the project is to become a reliable platform that accurately ranks coins/tokens based on how much traders and buying a selling using a mathematical algorithms. Coinguide isn't a website that gives investors financial advise on which coin to buy or not, it simply gets the required data from crypto exchanges's api processes the data using an algorithm and tells users the coins gaining popularity and those loosing popularity.

Previous Update

Link to first update here

Link to second update here

Link to third update here

Link to fourth update here

Link to fifth update here

Link to sixth update here

Link to seventh update here

Link to eight update here

Update:

Code Refactoring : As advised by @justyy, I am in the process of refactoring the code to improve functionalities and also reduce code redundancy. Right now, i have moved the entire project to PHP Laravel framework and i'm in the process of getting all available market synced. So far, tradesatoshi and cryptopia exchange market have been successful.

About us Page and details now available: Coinguide about us details now available. Thanks to a contributor @wizzybright for providing the details.

about.png

Privacy Policy Page and details now available: Coinguide privacy details now available. Thanks to a contributor @wizzybright for providing the details.

privacy policy.png

FAQs Page and details now available: Coinguide frequently asked questions details now available. Thanks to a contributor @wizzybright for providing the details.

faqs.png

How I implemented this.

Making use of PHP Laravel framework gives me the flexibility and also utilizing the MVC architecture.

Model file

<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Tradesatoshi extends Model
{
    //

    protected $fillable = [
      'id', 'coin', 'currencypair', 'buy', 'total_buy_trade', 'current_buy', 'last_total_buy_trade' , 'change'
    ];
}


Repository file handling the data and logic

<?php

namespace App\Http\Repositories;

use App\Tradesatoshi;

class TradesatoshiRepository
{

  protected $tradesatoshi;

  public function __construct(Tradesatoshi $tradesatoshi)
  {
      $this->tradesatoshi = $tradesatoshi;
  }


  public function saveData ($coin, $currencypair) {

      $save = Tradesatoshi::create([

            'coin' => $coin,
            'currencypair' => $currencypair

        ]);

        return $save ? true : false;

  }


  public function updateBuy ($currencypair, $buy)
  {

    $update = Tradesatoshi::where('currencypair', $currencypair)->update(['buy' => $buy]);
    return $update ? true : false;

  }


  public function updateTotalBuy ($total_buy_trade)
  {

    $update = Tradesatoshi::update(['total_buy_trade' => $total_buy_trade]);
    return $update ? true : false;

  }


  public function getAllCurrencyPair ()
  {

       $all = Tradesatoshi::select('currencypair')->get();
       return json_decode(json_encode($all) , TRUE);

  }


  public function getAllByLimit ()
  {

      $all = Tradesatoshi::get();
      return json_decode(json_encode($all) , TRUE);

  }

}

Controller file to handle request and renders the appropriate view with the model data as a response.

<?php

namespace App\Http\Controllers;

use Illuminate\Http\Request;

use App\Http\Repositories\TradesatoshiRepository;

class TradesatoshiController extends Controller
{

  protected $tradesatoshi;

  public function __construct(TradesatoshiRepository $tradesatoshi)
  {
      $this->tradesatoshi = $tradesatoshi;

  }

  public function getCoins ()
  {

      $coins = $this->tradesatoshi->getCoins();

      return $coins;

  }

  public function saveCoins ()
  {

      $coins = $this->getCoins();

      foreach ($coins as $key => $coin) {

          if ($coin['status'] == "OK") {

              $coin_name = $coin['currencyLong'];
              $currencypair = $coin['currency']."_BTC";

              $this->tradesatoshi->saveData ($coin_name, $currencypair);

          }

      }

  }

  public function getcurrencyPair ()
  {
      return $this->tradesatoshi->getAllCurrencyPair();
  }


  public function getMarketHistory ()
  {

      $currencypair = $this->getcurrencyPair();

      $total_buy_trade = 0;

      foreach ($currencypair as $key => $currencypair) {

          $currencypair = $currencypair['currencypair'];
          $market_history = $this->tradesatoshi->getSummary($currencypair);
          $result = $market_history['result'];

          $buy = 0;

          foreach ($result as $key => $summary) {

            if ($summary['orderType'] == "Buy") {

                $buy = $buy + 1;

            }

          }

          $update = $this->tradesatoshi->updateBuy ($currencypair , $buy);
          $total_buy_trade = $total_buy_trade + $buy;

      }

      $update_total_buy = $this->tradesatoshi->updateTotalBuy ($total_buy_trade);

  }

  public function viewMarket ()
  {

      $data['tradesatoshi'] = $this->tradesatoshi->getAllByLimit();
      return view ('markets.tradesatoshi', $data);

  }


}

Links to commits:

https://github.com/profchydon/coinguide/commit/f42814625eecb1669b15e1022a4d99bbab7054fe

https://github.com/profchydon/coinguide/commit/1173c88aa48296bf2329db2279009a9c2f36c1b2

https://github.com/profchydon/coinguide/commit/f63dc3e7a98ddfb7cef6947c4c396f1c457ab592

https://github.com/profchydon/coinguide/commit/383ccb1b64640c02094124f2b558c92ab5be6f5c



Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  
  ·  6 years ago 

Thanks for this. I can see this is heading a good direction, but we feel that code refactoring alone without new features cannot be accepted. You may put more work in your next contribution i.e. you can add a bit more work within 14 days of code refactoring PR so the refactoring bit can be taken into consideration.
Cheers.


Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.

[utopian-moderator]

Ok. I thougt as much @justyy
Thanks anyways

good work friend. success awaits you

Your Post Has Been Featured on @Resteemable!
Feature any Steemit post using resteemit.com!
How It Works:
1. Take Any Steemit URL
2. Erase https://
3. Type re
Get Featured Instantly & Featured Posts are voted every 2.4hrs
Join the Curation Team Here | Vote Resteemable for Witness