Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
P
PyFund
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
陈涛
PyFund
Commits
a3d3346d
Commit
a3d3346d
authored
Jun 12, 2023
by
陈涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
质押节点接口增加手续费fee字段
parent
31a6c4c7
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
4 deletions
+7
-4
nav.py
api/nav.py
+5
-3
bill.py
schema/bill.py
+1
-0
bill.py
service/bill.py
+1
-1
No files found.
api/nav.py
View file @
a3d3346d
import
datetime
from
typing
import
Optional
import
pytz
from
fastapi
import
APIRouter
,
Depends
,
Query
,
Body
from
fastapi.background
import
BackgroundTasks
from
motor.core
import
AgnosticCollection
...
...
@@ -50,8 +52,8 @@ async def create_nav(
fund_collect
:
AgnosticCollection
=
Depends
(
get_fund_collect
),
nav_collect
:
AgnosticCollection
=
Depends
(
get_nav_collect
),
):
fund_data
=
await
fund_collect
.
find
({
"id"
:
fund_id
})
fund_nav
=
build_fund_nav
(
fund_data
,
record_date
,
fund_share
,
nav
)
fund_data
=
await
fund_collect
.
find
_one
({
"id"
:
fund_id
})
fund_nav
=
build_fund_nav
(
fund_data
,
record_date
.
replace
(
hour
=
0
,
minute
=
0
,
second
=
0
,
microsecond
=
0
,
tzinfo
=
pytz
.
UTC
)
,
fund_share
,
nav
)
insert
=
await
nav_collect
.
insert_one
(
fund_nav
)
response
=
Response
(
data
=
insert
.
acknowledged
)
return
response
...
...
@@ -69,7 +71,7 @@ async def update_nav(
):
update_result
=
await
nav_collect
.
update_one
(
{
"id"
:
nav_id
,
"fund_id"
:
fund_id
},
{
"$set"
:
{
"record_date"
:
record_date
,
"nav"
:
nav
,
"fund_share"
:
fund_share
}}
{
"$set"
:
{
"record_date"
:
record_date
.
replace
(
hour
=
0
,
minute
=
0
,
second
=
0
,
microsecond
=
0
,
tzinfo
=
pytz
.
UTC
)
,
"nav"
:
nav
,
"fund_share"
:
fund_share
}}
)
response
=
Response
(
data
=
update_result
.
modified_count
)
return
response
...
...
schema/bill.py
View file @
a3d3346d
...
...
@@ -79,6 +79,7 @@ class CreateStakingBill(BaseModel):
pub_key
:
str
=
Field
(
...
,
description
=
'节点key'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
fee
:
float
=
Field
(
0
,
description
=
"手续费"
)
class
CreateAdjustBill
(
BaseModel
):
...
...
service/bill.py
View file @
a3d3346d
...
...
@@ -30,7 +30,7 @@ async def create_staking(
if
not
assets
or
assets
[
0
][
"volume"
]
<
create_bill
.
volume
>=
0
:
raise
APIError
(
message
=
"余额不足"
)
assets
[
0
][
'volume'
]
-=
create_bill
.
volume
assets
[
0
][
'volume'
]
-=
create_bill
.
volume
+
create_bill
.
fee
pending_asset
=
list
(
filter
(
lambda
x
:
x
[
"currency"
]
==
create_bill
.
currency
,
fund
.
get
(
'pending_assets'
,
[])))
if
pending_asset
:
...
...
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