Giter Club home page Giter Club logo

genesisglobaltest's Introduction

Code challenge

CRYPTO WALLET PERFORMANCE

1. OBJECTIVE

Your assignment is to implement a Java program that given a collection of crypto assets with their positions, it must retrieve, concurrently, their latest prices from the Coincap API and return the updated total financial value of the wallet with performance data.

Input CSV file representing the wallet with columns symbol, quantity, price

Output Print a line with total={},best_asset={},best_performance={},worst_asset={},worst_performance={}

Where

  • total: total financial value in USD of the entire wallet
  • best_asset: which asset had the best performance (value increase) from the input CSV compared to the latest price retrieved from the API
  • best_performance: percentage of the performance of the best_asset
  • worst_asset: which asset had the worst performance (value decrease) from the input CSV compared to the latest price retrieved from the API
  • worst_performance: percentage of the performance of the worst_asset
  • Values rounded to 2 decimal places, HALF_UP

2. TECHNICAL BRIEFING

Required environment, tools and languages:

  • Java 11+
  • Build the project with maven
  • Write your code in English
  • Read the CSV from src/main/resources and there is no need to validate the CSV, consider it will always be valid
  • Feel free to use any additional Java framework or libraries you want. Mandatory technical requirements:
  • Write unit tests, it’s up to you to mock or not the API for the unit tests
  • Retrieve the prices simultaneously by groups of 3 assets concurrently, i.e., at any point, at most 3 threads will be active processing tasks – but never singlethreaded (unless there is only one asset in the wallet). For example, if you process a wallet with more than 3 assets, and each API call takes 10s, your code should log something like: Now is 10:00:00 Submitted request ASSET_A at 10:00:01 Submitted request ASSET_B at 10:00:01 Submitted request ASSET_C at 10:00:01

(program hangs, waiting for some of the previous requests to finish)

Submitted request ASSET_D at 10:00:11

... Note: as you need to return the total value of the wallet, your program will have to wait until all assets have been processed.

3. EXAMPLE

  • GIVEN
    • symbol,quantity,price
    • BTC,0.12345,37870.5058
    • ETH,4.89532,2004.9774
  • WHEN 3 o Using Coincap Assets API, we get the asset ids “bitcoin” and “ethereum" respectively o Next, using the Coincap Assets History API, we get the prices “56999.9728252053067291” and “2032.1394325557042107” respectively
  • THEN Current BTC position is 0.12345 * 56999.9728252053067291 Current ETH position is 4.89532 * 2032.1394325557042107 Total = Current BTC Position + Current ETH Position BTC had an increase of 150% compared to original price of “37870.5058” and ETH an increase of 101% total=16984.62,best_asset=BTC,best_performance=1.51,worst_asse t=ETH,worst_performance=1.01

4. DELIVERABLES

Please upload your code to a remote git repo and send the link. Alternatively, send us a zip file with the code.

genesisglobaltest's People

Contributors

wmangoni avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.