Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
stock_new
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
sugar
stock_new
Commits
5edc28b6
Commit
5edc28b6
authored
Jun 20, 2024
by
wuxiaoli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改价格定义
parent
93a0af97
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
6 deletions
+6
-6
application/market/home/Trade.php
application/market/home/Trade.php
+6
-6
No files found.
application/market/home/Trade.php
View file @
5edc28b6
...
...
@@ -37,9 +37,9 @@ class Trade extends Common
$res
[
'market_value'
]
=
0
;
foreach
(
$pos
as
$k
=>
$v
)
{
$data
=
z_market
(
$v
[
'gupiao_code'
]);
if
(
$data
[
'
P
rice'
]
==
''
)
continue
;
$res
[
'return_money'
]
+=
(
$data
[
'
P
rice'
]
-
$v
[
'buy_average_price'
])
*
$v
[
'stock_count'
];
$res
[
'market_value'
]
+=
$data
[
'
P
rice'
]
*
$v
[
'stock_count'
];
if
(
$data
[
'
current_p
rice'
]
==
''
)
continue
;
$res
[
'return_money'
]
+=
(
$data
[
'
current_p
rice'
]
-
$v
[
'buy_average_price'
])
*
$v
[
'stock_count'
];
$res
[
'market_value'
]
+=
$data
[
'
current_p
rice'
]
*
$v
[
'stock_count'
];
}
// 提盈额度计算
$all
=
$res
[
'market_value'
]
+
$res
[
'avail'
];
...
...
@@ -86,16 +86,16 @@ class Trade extends Common
//查询子账户
$data
[
$k
][
'sub_account'
]
=
$res
[
'sub_account'
];
//提取当前价格
$data
[
$k
][
'now_price'
]
=
$Qdata
[
'
P
rice'
];
$data
[
$k
][
'now_price'
]
=
$Qdata
[
'
current_p
rice'
];
//市值 = 当前价格*数量
$data
[
$k
][
'market_value'
]
=
round
((
int
)
$Qdata
[
'
P
rice'
]
*
(
int
)
$item
[
'stock_count'
],
2
);
$data
[
$k
][
'market_value'
]
=
round
((
int
)
$Qdata
[
'
current_p
rice'
]
*
(
int
)
$item
[
'stock_count'
],
2
);
//参考成本价
$data
[
$k
][
'ck_price'
]
=
Position
::
calculate
(
$subid
,
$item
[
"gupiao_code"
],
'price'
);
//买入均价
$data
[
$k
][
'buy_average_price'
]
=
Position
::
calculate
(
$subid
,
$item
[
"gupiao_code"
],
'average'
);
//参考盈亏
//$data[$k]['ck_profit'] = $item['stock_count'] > 0 ? round(($Qdata['Price']-$data[$k]['buy_average_price'])*$item['stock_count'], 2) : 0;
$data
[
$k
][
'ck_profit'
]
=
$item
[
'stock_count'
]
>
0
?
bcmul
(
strval
((
int
)
$Qdata
[
"
P
rice"
]
-
(
int
)
$data
[
$k
][
'buy_average_price'
]),
strval
(
$item
[
'stock_count'
]),
2
)
:
0
;
//参考浮动盈亏
$data
[
$k
][
'ck_profit'
]
=
$item
[
'stock_count'
]
>
0
?
bcmul
(
strval
((
int
)
$Qdata
[
"
current_p
rice"
]
-
(
int
)
$data
[
$k
][
'buy_average_price'
]),
strval
(
$item
[
'stock_count'
]),
2
)
:
0
;
//参考浮动盈亏
//盈亏比例
//$data[$k]['profit_rate'] = $item['stock_count'] > 0 ? round(($data[$k]['ck_profit'] / ($data[$k]['buy_average_price'] * $item['stock_count'])) * 100, 2) : 0;
//$data[$k]['profit_rate'] = $item['stock_count'] > 0 ? bcdiv(strval($data[$k]['ck_profit']),strval($data[$k]['buy_average_price']*$item['stock_count']*100),2) : 0;//盈亏比例
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment