-
Notifications
You must be signed in to change notification settings - Fork 31
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #460 from opexdev/dev
Add logbook for better http logs
- Loading branch information
Showing
48 changed files
with
753 additions
and
537 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
53 changes: 53 additions & 0 deletions
53
...ntant-app/src/main/kotlin/co/nilin/opex/accountant/app/controller/PairConfigController.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
package co.nilin.opex.accountant.app.controller | ||
|
||
import co.nilin.opex.accountant.app.data.PairFeeResponse | ||
import co.nilin.opex.accountant.core.model.PairConfig | ||
import co.nilin.opex.accountant.core.model.PairFeeConfig | ||
import co.nilin.opex.accountant.core.spi.PairConfigLoader | ||
import co.nilin.opex.common.OpexError | ||
import co.nilin.opex.matching.engine.core.model.OrderDirection | ||
import org.springframework.web.bind.annotation.* | ||
|
||
@RestController | ||
@RequestMapping("/config") | ||
class PairConfigController(private val pairConfigLoader: PairConfigLoader) { | ||
|
||
@GetMapping("/{pair}/fee/{direction}-{userLevel}") | ||
suspend fun fetchPairFeeConfig( | ||
@PathVariable("pair") pair: String, | ||
@PathVariable("direction") direction: OrderDirection, | ||
@PathVariable("userLevel") level: String | ||
): PairFeeConfig { | ||
return pairConfigLoader.load(pair, direction, level) | ||
} | ||
|
||
@GetMapping("/{pair}/{direction}") | ||
suspend fun fetchPairConfig( | ||
@PathVariable("pair") pair: String, | ||
@PathVariable("direction") direction: OrderDirection | ||
): PairConfig { | ||
return pairConfigLoader.load(pair, direction) | ||
} | ||
|
||
@GetMapping("/all") | ||
suspend fun fetchPairConfigs(): List<PairConfig> { | ||
return pairConfigLoader.loadPairConfigs() | ||
} | ||
|
||
@GetMapping("/fee") | ||
suspend fun getFeeConfigs(): List<PairFeeResponse> { | ||
return pairConfigLoader.loadPairFeeConfigs() | ||
.map { PairFeeResponse(it.pairConfig.pair, it.direction, it.userLevel, it.makerFee, it.takerFee) } | ||
} | ||
|
||
@GetMapping("/fee/{pair}") | ||
suspend fun getFeeConfig( | ||
@PathVariable pair: String, | ||
@RequestParam(required = false) direction: OrderDirection?, | ||
@RequestParam(required = false) userLevel: String? | ||
): PairFeeResponse { | ||
val fee = pairConfigLoader.loadPairFeeConfigs(pair, direction ?: OrderDirection.BID, userLevel ?: "*") | ||
?: throw OpexError.PairFeeNotFound.exception() | ||
return PairFeeResponse(fee.pairConfig.pair, fee.direction, fee.userLevel, fee.makerFee, fee.takerFee) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 6 additions & 18 deletions
24
...roxy/src/main/kotlin/co/nilin/opex/accountant/ports/walletproxy/config/WebClientConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.