Skip to content

Commit

Permalink
fix: get close price by profit (#188)
Browse files Browse the repository at this point in the history
  • Loading branch information
Thrimbda authored Oct 16, 2023
1 parent f0b97f0 commit b47dd36
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 2 deletions.
10 changes: 10 additions & 0 deletions common/changes/@yuants/data-model/2023-10-16-12-37.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@yuants/data-model",
"comment": "bug fix",
"type": "patch"
}
],
"packageName": "@yuants/data-model"
}
10 changes: 10 additions & 0 deletions common/changes/@yuants/kernel/2023-10-16-12-37.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"changes": [
{
"packageName": "@yuants/kernel",
"comment": "bug fix",
"type": "patch"
}
],
"packageName": "@yuants/kernel"
}
2 changes: 1 addition & 1 deletion libraries/data-model/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export const getClosePriceByDesiredProfit = (

const beta = desiredProfit / (variant_coefficient * volume * (product.value_scale ?? 1));

if (product.value_unit === 'BASE') {
if (product.value_unit === 'NORM') {
return openPrice + beta / cross_product_exchange_rate;
}
if (product.quoted_currency === currency) {
Expand Down
2 changes: 1 addition & 1 deletion libraries/kernel/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export const getClosePriceByDesiredProfit = (

const beta = desiredProfit / (variant_coefficient * volume * (product.value_speed ?? 1));

if (product.is_underlying_base_currency) {
if (!product.is_underlying_base_currency) {
return openPrice + beta / cross_product_exchange_rate;
}
if (product.quoted_currency === currency) {
Expand Down

0 comments on commit b47dd36

Please sign in to comment.