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
5e4af2f5
Commit
5e4af2f5
authored
Mar 30, 2023
by
杨明橙
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改创建 调整账目,置换币账目 接口
parent
08b35f7b
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
93 additions
and
54 deletions
+93
-54
bill.py
api/bill.py
+83
-48
main.py
main.py
+2
-2
fund.py
model/fund.py
+3
-0
fund.py
service/fund.py
+3
-2
scheduler.py
service/scheduler.py
+2
-2
No files found.
api/bill.py
View file @
5e4af2f5
This diff is collapsed.
Click to expand it.
main.py
View file @
5e4af2f5
...
...
@@ -94,8 +94,8 @@ async def startup():
misfire_grace_time
=
20
)
if
settings
.
env
==
'LOCAL'
:
return
#
if settings.env == 'LOCAL':
#
return
app
.
state
.
scheduler
.
start
()
app
.
state
.
scheduler
.
print_jobs
()
...
...
model/fund.py
View file @
5e4af2f5
...
...
@@ -6,6 +6,7 @@ from pydantic import Field
from
model
import
MyBaseModel
from
model.node
import
BaseNode
from
schema.fund
import
FundType
,
FundStatus
from
tools.time_helper
import
utc_now_timestamp
class
BaseFundItem
(
MyBaseModel
):
...
...
@@ -29,6 +30,7 @@ class NormalFund(BaseFundItem):
adjust_assets
:
Dict
[
str
,
float
]
=
Field
(
default
=
{},
description
=
'调整账户持仓'
)
pending_assets
:
Dict
[
str
,
float
]
=
Field
(
default
=
{},
description
=
'pending资产'
)
staking_assets
:
Dict
[
str
,
float
]
=
Field
(
default
=
{},
description
=
'质押资产'
)
assets_update
:
float
=
Field
(
default_factory
=
utc_now_timestamp
,
description
=
'余额更新时间'
)
class
StakingFund
(
BaseFundItem
):
...
...
@@ -40,3 +42,4 @@ class StakingFund(BaseFundItem):
adjust_assets
:
Dict
[
str
,
float
]
=
Field
(
default
=
{},
description
=
'调整账户持仓'
)
pending_assets
:
Dict
[
str
,
float
]
=
Field
(
default
=
{},
description
=
'pending资产'
)
staking_assets
:
Dict
[
str
,
float
]
=
Field
(
default
=
{},
description
=
'质押资产'
)
assets_update
:
float
=
Field
(
default_factory
=
utc_now_timestamp
,
description
=
'余额更新时间'
)
service/fund.py
View file @
5e4af2f5
...
...
@@ -2,6 +2,7 @@ from typing import Tuple
from
exception.db
import
NotFundError
from
schema.fund
import
FundStatus
from
tools.time_helper
import
utc_now_timestamp
async
def
query_fund_assets
(
fund_collect
,
fund_id
,
user_id
=
None
,
fund_status
=
None
)
->
Tuple
[
dict
,
dict
,
dict
,
dict
]:
...
...
@@ -17,10 +18,10 @@ async def query_fund_assets(fund_collect, fund_id, user_id=None, fund_status=Non
# 修改资产
async
def
update_assets
(
fund_collect
,
fund_id
,
assets
=
None
,
adjust_assets
=
None
,
pending_assets
=
None
,
async
def
update_assets
(
fund_collect
,
fund_id
,
*
,
assets
=
None
,
adjust_assets
=
None
,
pending_assets
=
None
,
staking_assets
=
None
):
query
=
{
'id'
:
fund_id
}
update_data
=
{}
update_data
=
{
"assets_update"
:
utc_now_timestamp
()
}
if
assets
:
update_data
.
update
({
"assets"
:
assets
})
if
adjust_assets
:
...
...
service/scheduler.py
View file @
5e4af2f5
...
...
@@ -13,7 +13,7 @@ from dependencies import get_bill_collect, get_fund_collect
from
exception.http
import
RequestInvalidParamsError
from
schema.bill
import
StakingBillStatus
,
AllBillType
from
service.beacon
import
BeaconChaService
from
tools.time_helper
import
utc_now
from
tools.time_helper
import
utc_now
_timestamp
async
def
delete_task
(
job_id
,
scheduler
):
...
...
@@ -67,7 +67,7 @@ async def update_staking_bill_status_task(beacon_service: BeaconChaService, mong
if
status
:
await
bill_collect
.
find_one_and_update
(
{
'id'
:
bill_item
.
id
},
{
'$set'
:
{
"status"
:
status
,
"update_time"
:
utc_now
()}},
{
'$set'
:
{
"status"
:
status
,
"update_time"
:
utc_now
_timestamp
()}},
return_document
=
ReturnDocument
.
AFTER
)
if
status
==
StakingBillStatus
.
finish
:
fund_collect
=
get_fund_collect
(
mongodb_manager
)
...
...
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