-
Notifications
You must be signed in to change notification settings - Fork 0
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 #3 from swhite24/feature/weighted-buys
Feature/weighted buys
- Loading branch information
Showing
8 changed files
with
143 additions
and
53 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
package book | ||
|
||
import ( | ||
"strconv" | ||
|
||
"github.com/preichenberger/go-coinbasepro/v2" | ||
) | ||
|
||
// GetPrice delivers the best ask price for a particular product | ||
func GetPrice(client *coinbasepro.Client, product string) (float64, error) { | ||
book, err := client.GetBook(product, 1) | ||
if err != nil { | ||
return 0, err | ||
} | ||
|
||
return strconv.ParseFloat(book.Asks[0].Price, 64) | ||
} |
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 |
---|---|---|
@@ -1,22 +1,23 @@ | ||
variable region { default = "us-east-1" } | ||
variable function_name { default = "cbpro-buy-weekly" } | ||
variable lambda_schedule_expression { default = "cron(0 5 * * ? *)" } | ||
variable executable { default = "cbpro-buy-lambda" } | ||
variable archive { default = "cbpro-buy-lambda.zip" } | ||
variable "region" { default = "us-east-1" } | ||
variable "function_name" { default = "cbpro-buy-weekly" } | ||
variable "lambda_schedule_expression" { default = "cron(0 5 * * ? *)" } | ||
variable "executable" { default = "cbpro-buy-lambda" } | ||
variable "archive" { default = "cbpro-buy-lambda.zip" } | ||
# set to 1 or null | ||
variable auto_deposit { default = 1 } | ||
variable amount { default = 50 } | ||
variable currency { default = "USD" } | ||
variable product { default = "BTC" } | ||
variable cbpro_key { | ||
variable "auto_deposit" { default = 1 } | ||
variable "amount" { default = 50 } | ||
variable "currency" { default = "USD" } | ||
variable "product" { default = "BTC" } | ||
variable "use_basis" { default = true } | ||
variable "cbpro_key" { | ||
type = string | ||
sensitive = true | ||
} | ||
variable cbpro_passphrase { | ||
variable "cbpro_passphrase" { | ||
type = string | ||
sensitive = true | ||
} | ||
variable cbpro_secret { | ||
variable "cbpro_secret" { | ||
type = string | ||
sensitive = true | ||
} |