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
66b0e51a
Commit
66b0e51a
authored
Mar 28, 2023
by
confusion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改时间过滤查询bill
parent
7b495921
Changes
9
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
54 additions
and
44 deletions
+54
-44
bill.py
api/bill.py
+1
-1
node.py
api/node.py
+2
-1
__init__.py
model/__init__.py
+6
-8
asset.py
model/asset.py
+2
-2
bill.py
model/bill.py
+5
-5
node.py
model/node.py
+4
-19
bill.py
schema/bill.py
+13
-8
node.py
schema/node.py
+17
-0
time_helper.py
tools/time_helper.py
+4
-0
No files found.
api/bill.py
View file @
66b0e51a
...
@@ -244,7 +244,7 @@ async def query_bill(
...
@@ -244,7 +244,7 @@ async def query_bill(
):
):
query
=
{
"fund_id"
:
fund_id
,
"user_id"
:
user
.
id
,
"bill_type"
:
{
'$in'
:
query
}}
query
=
{
"fund_id"
:
fund_id
,
"user_id"
:
user
.
id
,
"bill_type"
:
{
'$in'
:
query
}}
if
filter_time
.
start_time
and
filter_time
.
end_time
:
if
filter_time
.
start_time
and
filter_time
.
end_time
:
query
.
update
({
'
create
_time'
:
filter_time
.
to_mongodb_query
()})
query
.
update
({
'
record
_time'
:
filter_time
.
to_mongodb_query
()})
skip
=
(
page
.
page
-
1
)
*
page
.
page_size
skip
=
(
page
.
page
-
1
)
*
page
.
page_size
cursor
=
bill_collect
.
find
(
query
)
cursor
=
bill_collect
.
find
(
query
)
...
...
api/node.py
View file @
66b0e51a
...
@@ -6,7 +6,8 @@ from model import BaseResponse
...
@@ -6,7 +6,8 @@ from model import BaseResponse
from
fastapi
import
APIRouter
,
Depends
from
fastapi
import
APIRouter
,
Depends
from
model.fund
import
FundType
from
model.fund
import
FundType
from
model.node
import
CreateNode
,
BaseNode
from
model.node
import
BaseNode
from
schema.node
import
CreateNode
from
tools.jwt_tools
import
User
from
tools.jwt_tools
import
User
router
=
APIRouter
()
router
=
APIRouter
()
...
...
model/__init__.py
View file @
66b0e51a
...
@@ -7,6 +7,8 @@ from pydantic import BaseModel, Field
...
@@ -7,6 +7,8 @@ from pydantic import BaseModel, Field
from
pydantic.generics
import
GenericModel
from
pydantic.generics
import
GenericModel
from
starlette
import
status
from
starlette
import
status
from
tools.time_helper
import
utc_now_timestamp
DataT
=
TypeVar
(
'DataT'
)
DataT
=
TypeVar
(
'DataT'
)
...
@@ -62,10 +64,8 @@ class ErrorResponse(BaseModel):
...
@@ -62,10 +64,8 @@ class ErrorResponse(BaseModel):
class
BaseCreateModel
(
BaseModel
):
class
BaseCreateModel
(
BaseModel
):
id
:
str
=
Field
(
default_factory
=
lambda
:
uuid
.
uuid1
()
.
__str__
(),
description
=
'唯一ID'
)
id
:
str
=
Field
(
default_factory
=
lambda
:
uuid
.
uuid1
()
.
__str__
(),
description
=
'唯一ID'
)
create_time
:
int
=
Field
(
default_factory
=
lambda
:
int
(
datetime
.
datetime
.
utcnow
()
.
timestamp
()),
create_time
:
int
=
Field
(
default_factory
=
utc_now_timestamp
,
description
=
'创建时间'
)
description
=
'创建时间'
)
update_time
:
int
=
Field
(
default_factory
=
utc_now_timestamp
,
description
=
'更新时间'
)
update_time
:
int
=
Field
(
default_factory
=
lambda
:
int
(
datetime
.
datetime
.
utcnow
()
.
timestamp
()),
description
=
'更新时间'
)
class
Config
:
class
Config
:
orm_mode
=
True
orm_mode
=
True
...
@@ -73,10 +73,8 @@ class BaseCreateModel(BaseModel):
...
@@ -73,10 +73,8 @@ class BaseCreateModel(BaseModel):
class
MyBaseModel
(
BaseModel
):
class
MyBaseModel
(
BaseModel
):
id
:
str
=
Field
(
default_factory
=
lambda
:
uuid
.
uuid1
()
.
__str__
(),
description
=
'唯一ID'
)
id
:
str
=
Field
(
default_factory
=
lambda
:
uuid
.
uuid1
()
.
__str__
(),
description
=
'唯一ID'
)
create_time
:
int
=
Field
(
default_factory
=
lambda
:
int
(
datetime
.
datetime
.
utcnow
()
.
timestamp
()),
create_time
:
int
=
Field
(
default_factory
=
utc_now_timestamp
,
description
=
'创建时间'
)
description
=
'创建时间'
)
update_time
:
int
=
Field
(
default_factory
=
utc_now_timestamp
,
description
=
'更新时间'
)
update_time
:
int
=
Field
(
default_factory
=
lambda
:
int
(
datetime
.
datetime
.
utcnow
()
.
timestamp
()),
description
=
'更新时间'
)
class
Config
:
class
Config
:
orm_mode
=
True
orm_mode
=
True
model/asset.py
View file @
66b0e51a
...
@@ -2,7 +2,7 @@ from enum import Enum
...
@@ -2,7 +2,7 @@ from enum import Enum
from
typing
import
List
from
typing
import
List
from
pydantic
import
BaseModel
,
Field
from
pydantic
import
BaseModel
,
Field
from
model
import
BaseCreateModel
from
model
import
BaseCreateModel
,
MyBaseModel
class
AssetType
(
str
,
Enum
):
class
AssetType
(
str
,
Enum
):
...
@@ -19,7 +19,7 @@ class BaseCoinAssetItem(BaseModel):
...
@@ -19,7 +19,7 @@ class BaseCoinAssetItem(BaseModel):
# 传入数据库类型 / 接口返回类型
# 传入数据库类型 / 接口返回类型
class
NormalAsset
(
BaseCreat
eModel
):
class
NormalAsset
(
MyBas
eModel
):
fund_id
:
str
=
Field
(
...
,
description
=
'基金id'
)
fund_id
:
str
=
Field
(
...
,
description
=
'基金id'
)
assets
:
List
[
BaseCoinAssetItem
]
=
Field
(
default
=
[],
description
=
'基金id'
)
assets
:
List
[
BaseCoinAssetItem
]
=
Field
(
default
=
[],
description
=
'基金id'
)
...
...
model/bill.py
View file @
66b0e51a
import
datetime
from
pydantic
import
Field
from
pydantic
import
Field
from
model
import
MyBaseModel
from
model
import
MyBaseModel
from
schema.bill
import
PCFBillType
,
BillType
,
StakingBillStatus
from
schema.bill
import
PCFBillType
,
BillType
,
StakingBillStatus
from
tools.time_helper
import
utc_now_timestamp
# 数据库类型 / 接口返回类型
# 数据库类型 / 接口返回类型
...
@@ -18,8 +17,8 @@ class PCFBill(MyBaseModel):
...
@@ -18,8 +17,8 @@ class PCFBill(MyBaseModel):
currency
:
str
=
Field
(
...
,
description
=
'币种'
)
currency
:
str
=
Field
(
...
,
description
=
'币种'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
price
:
float
=
Field
(
...
,
description
=
"价格"
)
price
:
float
=
Field
(
...
,
description
=
"价格"
)
record_time
:
str
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
class
ExchangeBill
(
MyBaseModel
):
class
ExchangeBill
(
MyBaseModel
):
...
@@ -29,6 +28,7 @@ class ExchangeBill(MyBaseModel):
...
@@ -29,6 +28,7 @@ class ExchangeBill(MyBaseModel):
output_value
:
float
=
Field
(
...
,
description
=
"输出价值"
)
output_value
:
float
=
Field
(
...
,
description
=
"输出价值"
)
profit
:
float
=
Field
(
0
,
description
=
"置换产生的价差"
)
profit
:
float
=
Field
(
0
,
description
=
"置换产生的价差"
)
bill_type
:
BillType
=
BillType
.
exchange
bill_type
:
BillType
=
BillType
.
exchange
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
class
StakingBill
(
MyBaseModel
):
class
StakingBill
(
MyBaseModel
):
...
@@ -41,8 +41,8 @@ class StakingBill(MyBaseModel):
...
@@ -41,8 +41,8 @@ class StakingBill(MyBaseModel):
currency
:
str
=
Field
(
default
=
"ETH"
,
description
=
'币种'
)
currency
:
str
=
Field
(
default
=
"ETH"
,
description
=
'币种'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'数量'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'数量'
)
pub_key
:
str
=
Field
(
...
,
description
=
'节点key'
)
pub_key
:
str
=
Field
(
...
,
description
=
'节点key'
)
record_time
:
str
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
class
AdjustBill
(
MyBaseModel
):
class
AdjustBill
(
MyBaseModel
):
...
@@ -52,5 +52,5 @@ class AdjustBill(MyBaseModel):
...
@@ -52,5 +52,5 @@ class AdjustBill(MyBaseModel):
fund_id
:
str
=
Field
(
...
,
description
=
'基金id'
)
fund_id
:
str
=
Field
(
...
,
description
=
'基金id'
)
currency
:
str
=
Field
(
'USD'
,
description
=
'币种'
)
currency
:
str
=
Field
(
'USD'
,
description
=
'币种'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
record_time
:
str
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
model/node.py
View file @
66b0e51a
from
enum
import
Enum
from
pydantic
import
Field
from
pydantic
import
Field
,
BaseModel
from
model
import
MyBaseModel
from
schema.node
import
NodeStatus
from
model
import
BaseCreateModel
class
BaseNode
(
MyBaseModel
):
class
NodeStatus
(
str
,
Enum
):
pending
=
'pending'
active
=
'active'
stop
=
'stop'
class
BaseNode
(
BaseCreateModel
):
pub_key
:
str
=
Field
(
...
,
description
=
'绑定的key'
)
pub_key
:
str
=
Field
(
...
,
description
=
'绑定的key'
)
status
:
NodeStatus
=
Field
(
default
=
NodeStatus
.
pending
,
description
=
'状态'
)
status
:
NodeStatus
=
Field
(
default
=
NodeStatus
.
pending
,
description
=
'状态'
)
currency
:
str
=
Field
(
default
=
'ETH'
,
description
=
'节点需要质押的币种'
)
currency
:
str
=
Field
(
default
=
'ETH'
,
description
=
'节点需要质押的币种'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'节点需要质押的币种数量'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'节点需要质押的币种数量'
)
# 接口请求模型 创建
class
CreateNode
(
BaseModel
):
pub_key
:
str
=
Field
(
...
,
description
=
'绑定的key'
)
fund_id
:
str
=
Field
(
...
,
description
=
'绑定基金的ID'
)
currency
:
str
=
Field
(
default
=
'ETH'
,
description
=
'节点需要质押的币种'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'节点需要质押的币种数量'
)
schema/bill.py
View file @
66b0e51a
...
@@ -4,6 +4,8 @@ from typing import Optional
...
@@ -4,6 +4,8 @@ from typing import Optional
from
pydantic
import
BaseModel
,
Field
from
pydantic
import
BaseModel
,
Field
from
tools.time_helper
import
utc_now_timestamp
class
PCFBillType
(
str
,
Enum
):
class
PCFBillType
(
str
,
Enum
):
# 申购
# 申购
...
@@ -51,8 +53,8 @@ class CreatePCFBill(BaseModel):
...
@@ -51,8 +53,8 @@ class CreatePCFBill(BaseModel):
currency
:
str
=
Field
(
...
,
description
=
'币种'
)
currency
:
str
=
Field
(
...
,
description
=
'币种'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
price
:
float
=
Field
(
...
,
description
=
"价格"
)
price
:
float
=
Field
(
...
,
description
=
"价格"
)
record_time
:
str
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
class
CreateExchangeBill
(
BaseModel
):
class
CreateExchangeBill
(
BaseModel
):
...
@@ -63,8 +65,8 @@ class CreateExchangeBill(BaseModel):
...
@@ -63,8 +65,8 @@ class CreateExchangeBill(BaseModel):
output_currency
:
str
=
Field
(
...
,
description
=
"输出币种"
)
output_currency
:
str
=
Field
(
...
,
description
=
"输出币种"
)
output_price
:
float
=
Field
(
...
,
description
=
"输出币种价格"
)
output_price
:
float
=
Field
(
...
,
description
=
"输出币种价格"
)
output_volume
:
float
=
Field
(
...
,
description
=
"输出数量"
)
output_volume
:
float
=
Field
(
...
,
description
=
"输出数量"
)
record_time
:
str
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
class
CreateStakingBill
(
BaseModel
):
class
CreateStakingBill
(
BaseModel
):
...
@@ -73,16 +75,16 @@ class CreateStakingBill(BaseModel):
...
@@ -73,16 +75,16 @@ class CreateStakingBill(BaseModel):
currency
:
str
=
Field
(
default
=
"ETH"
,
description
=
'币种'
)
currency
:
str
=
Field
(
default
=
"ETH"
,
description
=
'币种'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'数量'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'数量'
)
pub_key
:
str
=
Field
(
...
,
description
=
'节点key'
)
pub_key
:
str
=
Field
(
...
,
description
=
'节点key'
)
record_time
:
str
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
class
CreateAdjustBill
(
BaseModel
):
class
CreateAdjustBill
(
BaseModel
):
fund_id
:
str
=
Field
(
...
,
description
=
'基金id'
)
fund_id
:
str
=
Field
(
...
,
description
=
'基金id'
)
currency
:
str
=
Field
(
'USD'
,
description
=
'币种'
)
currency
:
str
=
Field
(
'USD'
,
description
=
'币种'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
volume
:
float
=
Field
(
...
,
description
=
'资产数量'
)
record_time
:
str
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
str
=
Field
(
default
=
""
,
description
=
"备注"
)
record_time
:
int
=
Field
(
default_factory
=
lambda
:
utc_now_timestamp
(),
description
=
'记录时间'
)
# 更新schema
# 更新schema
...
@@ -93,7 +95,8 @@ class UpdatePCFBill(BaseModel):
...
@@ -93,7 +95,8 @@ class UpdatePCFBill(BaseModel):
price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"价格"
)
price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"价格"
)
fund_share
:
Optional
[
float
]
=
Field
(
None
,
description
=
"基金份额"
)
fund_share
:
Optional
[
float
]
=
Field
(
None
,
description
=
"基金份额"
)
market_value
:
Optional
[
float
]
=
Field
(
None
,
description
=
"市值"
)
market_value
:
Optional
[
float
]
=
Field
(
None
,
description
=
"市值"
)
record_time
:
Optional
[
str
]
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
record_time
:
Optional
[
int
]
=
Field
(
None
,
description
=
'记录时间'
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
class
Config
:
class
Config
:
...
@@ -107,7 +110,8 @@ class UpdateExchangeBill(BaseModel):
...
@@ -107,7 +110,8 @@ class UpdateExchangeBill(BaseModel):
output_currency
:
Optional
[
str
]
=
Field
(
None
,
description
=
"输出币种"
)
output_currency
:
Optional
[
str
]
=
Field
(
None
,
description
=
"输出币种"
)
output_price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"输出币种价格"
)
output_price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"输出币种价格"
)
output_volume
:
Optional
[
float
]
=
Field
(
None
,
description
=
"输出数量"
)
output_volume
:
Optional
[
float
]
=
Field
(
None
,
description
=
"输出数量"
)
record_time
:
Optional
[
str
]
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
record_time
:
Optional
[
int
]
=
Field
(
None
,
description
=
'记录时间'
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
class
Config
:
class
Config
:
...
@@ -119,7 +123,8 @@ class UpdateStakingBill(BaseModel):
...
@@ -119,7 +123,8 @@ class UpdateStakingBill(BaseModel):
currency
:
Optional
[
str
]
=
Field
(
None
,
description
=
'币种'
)
currency
:
Optional
[
str
]
=
Field
(
None
,
description
=
'币种'
)
volume
:
Optional
[
float
]
=
Field
(
None
,
description
=
'数量'
)
volume
:
Optional
[
float
]
=
Field
(
None
,
description
=
'数量'
)
price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"价格"
)
price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"价格"
)
record_time
:
Optional
[
str
]
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
()),
description
=
'记录时间'
)
record_time
:
Optional
[
int
]
=
Field
(
None
,
description
=
'记录时间'
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
class
Config
:
class
Config
:
...
@@ -130,7 +135,7 @@ class UpdateAdjustBill(BaseModel):
...
@@ -130,7 +135,7 @@ class UpdateAdjustBill(BaseModel):
currency
:
Optional
[
str
]
=
Field
(
None
,
description
=
'币种'
)
currency
:
Optional
[
str
]
=
Field
(
None
,
description
=
'币种'
)
volume
:
Optional
[
float
]
=
Field
(
None
,
description
=
'资产数量'
)
volume
:
Optional
[
float
]
=
Field
(
None
,
description
=
'资产数量'
)
price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"价格"
)
price
:
Optional
[
float
]
=
Field
(
None
,
description
=
"价格"
)
record_time
:
Optional
[
str
]
=
Field
(
default_factory
=
lambda
:
str
(
datetime
.
datetime
.
utcnow
()
.
date
())
,
description
=
'记录时间'
)
record_time
:
Optional
[
int
]
=
Field
(
None
,
description
=
'记录时间'
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
remark
:
Optional
[
str
]
=
Field
(
default
=
""
,
description
=
"备注"
)
class
Config
:
class
Config
:
...
...
schema/node.py
0 → 100644
View file @
66b0e51a
from
enum
import
Enum
from
pydantic
import
Field
,
BaseModel
class
NodeStatus
(
str
,
Enum
):
pending
=
'pending'
active
=
'active'
stop
=
'stop'
# 接口请求模型 创建
class
CreateNode
(
BaseModel
):
pub_key
:
str
=
Field
(
...
,
description
=
'绑定的key'
)
fund_id
:
str
=
Field
(
...
,
description
=
'绑定基金的ID'
)
currency
:
str
=
Field
(
default
=
'ETH'
,
description
=
'节点需要质押的币种'
)
volume
:
float
=
Field
(
default
=
32
,
description
=
'节点需要质押的币种数量'
)
tools/time_helper.py
View file @
66b0e51a
...
@@ -7,5 +7,9 @@ def utc_now():
...
@@ -7,5 +7,9 @@ def utc_now():
return
datetime
.
datetime
.
utcnow
()
.
replace
(
tzinfo
=
pytz
.
UTC
)
return
datetime
.
datetime
.
utcnow
()
.
replace
(
tzinfo
=
pytz
.
UTC
)
def
utc_now_timestamp
():
return
int
(
utc_now
()
.
timestamp
())
def
timestamp_to_datetime
(
utc_timestamp
):
def
timestamp_to_datetime
(
utc_timestamp
):
return
datetime
.
datetime
.
utcfromtimestamp
(
utc_timestamp
)
.
replace
(
tzinfo
=
pytz
.
UTC
)
return
datetime
.
datetime
.
utcfromtimestamp
(
utc_timestamp
)
.
replace
(
tzinfo
=
pytz
.
UTC
)
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