-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve returned trade result information
- Loading branch information
Showing
33 changed files
with
1,384 additions
and
622 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
#pragma once | ||
|
||
#include "coincentercommand.hpp" | ||
#include "coincentercommandtype.hpp" | ||
#include "coincenteroptions.hpp" | ||
|
||
namespace cct { | ||
class StringOptionParser; | ||
|
||
class CoincenterCommandFactory { | ||
public: | ||
CoincenterCommandFactory(const CoincenterCmdLineOptions &cmdLineOptions, const CoincenterCommand *pPreviousCommand) | ||
: _cmdLineOptions(cmdLineOptions), _pPreviousCommand(pPreviousCommand) {} | ||
|
||
static CoincenterCommand CreateMarketCommand(StringOptionParser &optionParser); | ||
|
||
CoincenterCommand createOrderCommand(CoincenterCommandType type, StringOptionParser &optionParser); | ||
|
||
CoincenterCommand createTradeCommand(CoincenterCommandType type, StringOptionParser &optionParser); | ||
|
||
CoincenterCommand createWithdrawApplyCommand(StringOptionParser &optionParser); | ||
|
||
CoincenterCommand createWithdrawApplyAllCommand(StringOptionParser &optionParser); | ||
|
||
private: | ||
const CoincenterCmdLineOptions &_cmdLineOptions; | ||
const CoincenterCommand *_pPreviousCommand; | ||
}; | ||
} // namespace cct |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#pragma once | ||
|
||
#include <span> | ||
#include <utility> | ||
|
||
#include "cct_smallvector.hpp" | ||
#include "cct_type_traits.hpp" | ||
#include "exchangename.hpp" | ||
#include "monetaryamount.hpp" | ||
|
||
namespace cct { | ||
class TransferableCommandResult { | ||
public: | ||
TransferableCommandResult(ExchangeName targetedExchange, MonetaryAmount resultedAmount) | ||
: _targetedExchange(std::move(targetedExchange)), _resultedAmount(resultedAmount) {} | ||
|
||
const ExchangeName &targetedExchange() const { return _targetedExchange; } | ||
MonetaryAmount resultedAmount() const { return _resultedAmount; } | ||
|
||
using trivially_relocatable = is_trivially_relocatable<ExchangeName>::type; | ||
|
||
bool operator==(const TransferableCommandResult &) const noexcept = default; | ||
|
||
private: | ||
ExchangeName _targetedExchange; | ||
MonetaryAmount _resultedAmount; | ||
}; | ||
|
||
using TransferableCommandResultVector = SmallVector<TransferableCommandResult, 1>; | ||
|
||
class CoincenterCommand; | ||
|
||
std::pair<MonetaryAmount, ExchangeNames> ComputeTradeAmountAndExchanges( | ||
const CoincenterCommand &cmd, std::span<const TransferableCommandResult> previousTransferableResults); | ||
|
||
std::pair<MonetaryAmount, ExchangeName> ComputeWithdrawAmount( | ||
const CoincenterCommand &cmd, std::span<const TransferableCommandResult> previousTransferableResults); | ||
} // namespace cct |
Oops, something went wrong.