Anxo Rodriguez
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights New
    • Engagement control
    • Make a copy
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Note Insights Versions and GitHub Sync Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Make a copy Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       Owned this note    Owned this note      
    Published Linked with GitHub
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    # Price settlement representations A company is receiving price quote on different products (Oil, Red Wine, etc) and in different currency (EUR, GBP, JPY, USD, ...) Every 5 minutes, the company will execute some of the orders following the rules of offer and demand. Settlements therefore are just a list of TOKENS (assets you buy, or the currency you use to pay) that are part of the solution, together with the trades that are executing. One trivial example is: - Bob wants to buy 5 red wine bottles 🍷 at most 10 EUR the bottle. - Alice wants to sell 100 red wine bottles for at least 9 EUR the bottle. A settlement will be able to satisfy Bob and Alice, and may decide to set the price in 9.5 EUR The settlement could look like: ```json= { "tokens": { "EUR": { "label": "EUR" }, "RED": { "label": "Red wine" } }, "prices": { "EUR": "1.0", "RED": "9.5" }, "orders": { "01": { "sell_token": "EUR", "buy_token": "RED", "sell_amount": "50.0", "buy_amount": "10.0", "is_sell_order": false, "allow_partial_fill": false, "exec_sell_amount": "47.5", "exec_buy_amount": "5" }, "02": { "sell_token": "RED", "buy_token": "EUR", "sell_amount": "100", "buy_amount": "900", "is_sell_order": true, "allow_partial_fill": true, "exec_sell_amount": "5", "exec_buy_amount": "47.5" } } } ``` Note that in the settlement: - Bob wants either to buy at his price or better, but only if he can get the 5 bottles of wines (`allow_partial_fill = false`) - Alice, is a merchant, she is willing to accept partial orders - `sell_amount/buy_amount` defines the price. For Bob it means "at most that price" or better, this is because it's a buy order - For alice, the price the price means "at least", because its a sell order - `exec_sell_amount`, `exec_buy_amount` reflects how much of the order is executed in the settlement ## The challenge **We need to build a React component that represent a settlement given a JSON.** In the following link, you will find an example of something similar (use only as a reference, use your best jusgement to decide how it should look like): https://defiant-owl.surge.sh/solution-graph.html At the end of this document, you will find an example of a settlemnt. Some keys for doing this settlement: - The solution should allow to personalize the nodes, so we can add images for representing currencies and product. Although including image is not strictly required. - Nice to be able to visualize in tooltips or similar different aspects of the node or trade - You can, and probably should, use a 3rd party library to represent the graph - The example presents one typical example, but we would like you to take into account that settlements can be simpler or way more complicated than this (many products and currency). It shold be easy to visualize the solution. - Is not required to have a perfectly finished solution, the most important part will be to present the options that were considered, and why one is chosen over the other for this specific problem - Ideally would have a working snipped of code in a React/Typescript. It can be used CRA or https://codesandbox.io or any other option. - Only the component will be relevant for the review, setup of the app or anything out of this component is excluded from the challenge review ## Delivery format The solution should come with a simple doc explaining the solution applied and why, pros/cons. The code doesn't need to be complete, it can be explained in text how would you tackle the problem or improve the provided code. The code can be delivered in https://codesandbox.io or in a github repository. ## Time estimation `3h` It's not the purpose of the challenge to build the perfect component, but to propose a pragmatic solution to the problem and explain your reasonings. ## Example of a settlement ```json= { "tokens": { "EUR": { "label": "EUR" }, "OIL": { "label": "Oil" } "RED": { "label": "Red wine" } }, "prices": { "EUR": "1.0", "OIL": "13.0", "RED": "14.0" }, "orders": { "01": { "sell_token": "RED", "buy_token": "OIL", "sell_amount": "12.0", "buy_amount": "12.0", "is_sell_order": true, "allow_partial_fill": false, "exec_sell_amount": "12.0", "exec_buy_amount": "12.923" }, "02": { "sell_token": "OIL", "buy_token": "RED", "sell_amount": "2.0", "buy_amount": "2.2", "is_sell_order": true, "allow_partial_fill": false, "exec_sell_amount": "0.0", "exec_buy_amount": "0.0" }, "03": { "sell_token": "RED", "buy_token": "EUR", "sell_amount": "10.0", "buy_amount": "150.0", "is_sell_order": true, "allow_partial_fill": false, "exec_sell_amount": "0.0", "exec_buy_amount": "0.0" }, "04": { "sell_token": "OIL", "buy_token": "EUR", "sell_amount": "15.0", "buy_amount": "180.0", "is_sell_order": true, "allow_partial_fill": false, "exec_sell_amount": "15.0", "exec_buy_amount": "195.0" }, "05": { "sell_token": "EUR", "buy_token": "OIL", "sell_amount": "52.0", "buy_amount": "4.0", "is_sell_order": false, "allow_partial_fill": true, "exec_sell_amount": "27.0", "exec_buy_amount": "2.077" }, "06": { "sell_token": "EUR", "buy_token": "RED", "sell_amount": "280.0", "buy_amount": "20.0", "is_sell_order": false, "allow_partial_fill": true, "exec_sell_amount": "168.0", "exec_buy_amount": "12.0" } } } ```

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully