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
08812a66
Commit
08812a66
authored
May 19, 2023
by
陈涛
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改scheduler获取
parent
e10b6aea
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
2 additions
and
6 deletions
+2
-6
fund.py
api/fund.py
+2
-6
No files found.
api/fund.py
View file @
08812a66
...
@@ -6,8 +6,6 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler
...
@@ -6,8 +6,6 @@ from apscheduler.schedulers.asyncio import AsyncIOScheduler
from
fastapi
import
APIRouter
,
Depends
,
Query
,
Request
from
fastapi
import
APIRouter
,
Depends
,
Query
,
Request
from
motor.core
import
AgnosticCollection
from
motor.core
import
AgnosticCollection
from
pymongo
import
ReturnDocument
from
pymongo
import
ReturnDocument
from
starlette.background
import
BackgroundTasks
from
exception.db
import
NotFundError
from
exception.db
import
NotFundError
from
model
import
Response
,
PageResponse
,
Page
from
model
import
Response
,
PageResponse
,
Page
from
model.fund
import
FundType
,
StakingFund
,
NormalFund
,
FundStatus
from
model.fund
import
FundType
,
StakingFund
,
NormalFund
,
FundStatus
...
@@ -28,19 +26,17 @@ fund_type_map = {
...
@@ -28,19 +26,17 @@ fund_type_map = {
summary
=
'创建基金'
,
summary
=
'创建基金'
,
description
=
'创建基金'
)
description
=
'创建基金'
)
async
def
create
(
async
def
create
(
request
:
Request
,
create_fund
:
CreateFund
,
create_fund
:
CreateFund
,
user
:
User
=
Depends
(
get_current_user
),
user
:
User
=
Depends
(
get_current_user
),
fund_collect
:
AgnosticCollection
=
Depends
(
get_fund_collect
)
fund_collect
:
AgnosticCollection
=
Depends
(
get_fund_collect
),
scheduler
:
AsyncIOScheduler
=
Depends
(
get_scheduler
)
):
):
create_model
=
fund_type_map
[
create_fund
.
fund_type
](
**
create_fund
.
dict
(),
nodes
=
[],
**
user
.
db_save
())
create_model
=
fund_type_map
[
create_fund
.
fund_type
](
**
create_fund
.
dict
(),
nodes
=
[],
**
user
.
db_save
())
create_model
.
nav
=
create_model
.
base_nav
create_model
.
nav
=
create_model
.
base_nav
data
=
create_model
.
dict
()
data
=
create_model
.
dict
()
response_model
=
fund_type_map
[
data
[
'fund_type'
]]
response_model
=
fund_type_map
[
data
[
'fund_type'
]]
await
fund_collect
.
insert_one
(
data
)
await
fund_collect
.
insert_one
(
data
)
scheduler
=
request
.
app
.
state
.
scheduler
job_id
=
f
"calculate_nav_{data['id']}"
job_id
=
f
"calculate_nav_{data['id']}"
time_obj
=
datetime
.
datetime
.
strptime
(
data
[
"settlement_time"
],
"
%
H:
%
M"
)
time_obj
=
datetime
.
datetime
.
strptime
(
data
[
"settlement_time"
],
"
%
H:
%
M"
)
scheduler
.
add_job
(
scheduler
.
add_job
(
...
...
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