This repository has been archived by the owner on Feb 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8afec86
commit 081aa21
Showing
9 changed files
with
368 additions
and
4 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package api | ||
|
||
import ( | ||
"fmt" | ||
) | ||
|
||
// SubmitMode is the type of mode to be used when submitting orders to the trader bot | ||
type SubmitMode uint8 | ||
|
||
// constants for the SubmitMode | ||
const ( | ||
SubmitModeMakerOnly SubmitMode = iota | ||
SubmitModeBoth | ||
) | ||
|
||
// ParseSubmitMode converts a string to the SubmitMode constant | ||
func ParseSubmitMode(submitMode string) (SubmitMode, error) { | ||
if submitMode == "maker_only" { | ||
return SubmitModeMakerOnly, nil | ||
} else if submitMode == "both" || submitMode == "" { | ||
return SubmitModeBoth, nil | ||
} | ||
|
||
return SubmitModeBoth, fmt.Errorf("unable to parse submit mode: %s", submitMode) | ||
} | ||
|
||
func (s *SubmitMode) String() string { | ||
if *s == SubmitModeMakerOnly { | ||
return "maker_only" | ||
} | ||
|
||
return "both" | ||
} |
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.