|
1 | 1 | # RCrypto |
2 | 2 | Realtime Crypto (RCrypto) is a build a system that saves real-time BTC & ETH prices in Kenya Shilling. |
| 3 | + |
| 4 | +#### Live API <a href="https://rcrypto.herokuapp.com/"> View Here </a> |
| 5 | + |
| 6 | +#### Live Release |
| 7 | +Compiled Build : <a href="https://github.com/Chal13W1zz/RCrypto/releases">Download Here</a> |
| 8 | +Run the package using `java -jar RCrypto<version>.jar` |
| 9 | + |
| 10 | +## API Features |
| 11 | + |
| 12 | +1. Users can sync realtime BTC and ETH prices. |
| 13 | +2. Users can retrieve BTC and Historical prices from the database. |
| 14 | +3. Users can add new BTC and ETH records manually |
| 15 | +4. [TO DO] The api has basic authentication. |
| 16 | + |
| 17 | +### Dependencies |
| 18 | + |
| 19 | + 1. [junit-jupiter-api] 'org.junit.jupiter:junit-jupiter-api:5.8.1' |
| 20 | + 2. [junit-jupiter-engine] 'org.junit.jupiter:junit-jupiter-engine:5.8.1' |
| 21 | + 3. [spark-core] 'com.sparkjava:spark-core:2.9.3' |
| 22 | + 4. [slf4j-simple] 'org.slf4j:slf4j-simple:1.7.32' |
| 23 | + 5. [gson] 'com.google.code.gson:gson:2.8.9' |
| 24 | + 6. [retrofit] 'com.squareup.retrofit2:retrofit:2.9.0' |
| 25 | + 7. [postgresql] group: 'org.postgresql', name: 'postgresql', version: '42.2.2' |
| 26 | + 8. [okhttp] 'com.squareup.okhttp3:okhttp:4.9.3' |
| 27 | + 9. [sql2o] 'group: 'org.sql2o', name: 'sql2o', version: '1.5.4' |
| 28 | + 10.[converter-gson] 'com.squareup.retrofit2:converter-gson:2.9.0' |
| 29 | + |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +## Getting Started |
| 34 | + |
| 35 | + 1. git clone https://github.com/Chal13W1zz/RCrypto.git |
| 36 | + |
| 37 | + 2. cd RCrypto |
| 38 | + |
| 39 | + 3. edit postgresql username and password in App.java |
| 40 | + |
| 41 | + 4. run psql < create.sql in the project root to create the database |
| 42 | + |
| 43 | + 5. gradle run / mvn run to start up the api locally |
| 44 | + |
| 45 | + |
| 46 | +## Tests [TO DO] |
| 47 | + 1. cd RCrypto |
| 48 | + 2. gradle test |
| 49 | + |
| 50 | +## API Endpoints |
| 51 | + |
| 52 | + |
| 53 | +| EndPoint | Functionality | |
| 54 | +| --------------------------------------- | ------------------------------------:| |
| 55 | +| GET /records/sync | sync and realtime prices departments | |
| 56 | +| GET /records/view | View historical prices | |
| 57 | +| POST /records/add | Manually add new price records | |
| 58 | + |
| 59 | + |
| 60 | + |
| 61 | +## Request & Response examples |
| 62 | +Request curl `/records/add` |
| 63 | + |
| 64 | + |
| 65 | +```curl |
| 66 | +curl --location --request POST 'https://rcrypto.herokuapp.com/records/add' \ |
| 67 | +--header 'Content-Type: application/json' \ |
| 68 | +--data-raw ' { |
| 69 | + "bitcoin": { |
| 70 | + "usd": 41493 |
| 71 | + }, |
| 72 | + "ethereum": { |
| 73 | + "usd": 3026.81 |
| 74 | + } |
| 75 | + }' |
| 76 | +``` |
| 77 | + |
| 78 | +Response (application/json) |
| 79 | +```curl |
| 80 | +{ |
| 81 | + "bitcoin": { |
| 82 | + "usd": 41493 |
| 83 | + }, |
| 84 | + "ethereum": { |
| 85 | + "usd": 3026.81 |
| 86 | + }, |
| 87 | + "id": 44 |
| 88 | +} |
| 89 | +``` |
| 90 | + |
| 91 | +Request curl `/records/sync` |
| 92 | + |
| 93 | +```curl |
| 94 | +curl --location --request GET 'https://rcrypto.herokuapp.com/records/sync' \ |
| 95 | +--header 'Content-Type: application/json' |
| 96 | +``` |
| 97 | +Response (application/json) |
| 98 | + |
| 99 | +```curl |
| 100 | +{ |
| 101 | +"bitcoin": { |
| 102 | +"usd": 41493 |
| 103 | +}, |
| 104 | +"ethereum": { |
| 105 | +"usd": 3026.81 |
| 106 | +}, |
| 107 | +"id": 0 |
| 108 | +} |
| 109 | +
|
| 110 | +``` |
| 111 | + |
| 112 | +## Limitations |
| 113 | + |
| 114 | +1. The API only responds with JSON |
| 115 | +2. TO DO "respond with xml" |
| 116 | + |
| 117 | +## Contribution |
| 118 | + |
| 119 | +1. Fork it! :fork_and_knife: |
| 120 | +2. Create your feature branch: `git checkout -b my-new-feature` |
| 121 | +3. Commit your changes: `git add -A && git commit -m 'Add some feature'` |
| 122 | +4. Push to the branch: `git push origin my-new-feature` |
| 123 | +5. Submit a pull request |
0 commit comments