Skip to content

Acruval/NoFrixionTask

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NoFrixionTest

Test for NoFrixion Antonio de la Cruz

https://github.com/Acruval/NoFrixionTask

Index

Task to do

It would help us with your application process if you could complete a small programming task. The task is below.

We're not expecting you to spend a huge amount of time on it. If you do find you're stuck after an hour or so, just send in what you have. We use the test as a rough guide and not as a pass/fail.

Write a console application in C# to get the latest Bitcoin price from https://www.coindesk.com/coindesk-api.

-If you have a GitHub/GitLab or similar account please create a repository for the example (can be private if you wish) and email me the details. If not, you can zip your sample up and email it to me.

Notes

  • This project is done in NET core 6.0 so you will need VS2022 to open
  • Install Mark Editor2. This can be very useful to read MD doc from VS (like this document)

Architecture

  • There is appsettignsfile
  • The is a Dependency injector. (It is overkill for this example, but the purpose is showing a real App)
  • There is a file log done with NLog.
  • Services
    • CoinDeskService. Bring data from DeskCoin.
    • JsonSerialize. Deserialize Json. Use stream instead.
  • *BusinessLayer. At the moment it is doing just a small transformation of data. It is good to have your own Ticker class, Candle Class, Time Interval Enum, to isolate types of your exchange provider.

Possible Improvements

  • CoinDeskService.
    • We are not returning a collection. But if that would be the case, use IEnumerableTask
    • It could be nice to have a socket service in order to get price change notifications instead has to call it for updating
    • Is is not necessary here but manage Authentication/Authorization for example by Bearing Token
  • JsonSerialize.
    • Investigate even better serialization/Deserialization for .Net. I guest This can be more async
  • BusinesLayer.
    • At the moment we have a console App that starts and finishes. but could be more complex business logic or as an example use the MaxAge to keep a cache, and avoid deserializing despite the HTTP cache
  • Unit test.
  • BenchMark Test. We need to check preformance in High frecuency trading

Other technical notes

_ Nullable Types Diable. Own library used. See [No Nullable Types but Contracts].

What was the default Console App

  • Mind this is the new console style.
  // See https://aka.ms/new-console-template for more information
  Console.WriteLine("Hello, World!");

No Nullable Types but Contracts

There is a new feature in NET6.0 enable by default.

    <Nullable>disable</Nullable>

that it is useful to avoid calling null references. The million-dollar mistake

so if we have

   string str; //Error must be initialized.

this must be initialized unless we have

   string? str;

At the moment I am using for it My own Contract library in this way.

  _httpClientFactory = httpClientFactory;
  CoreContracts.Postcondition(_httpClientFactory != null);

This this a redux implementation equivalent the deprecated CodeContracts (there is no invariants, for example) but in my case, because a popup in a WebApi app has no too much sense, it only stops the debugger in the ContractAssertion Fail when you are in DEBUG mode. No check and no performance penalty in RELEASE mode.

Still it is more powerfull than Nullable Enabed*, because you can use thins like

  CoreContracts.Preconditocondition(sqrtInput > 0); 

About

No Frixion Text. Architecture to get BitcoinPrice from CoinDesk https://github.com/Acruval/NoFrixionTask

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages