互联网和移动互联网给传统的零售行业带来了巨大的冲击,很多的零售商开始寻求经营模式和方向的转型,这本身就是一种行业的进步,而随着电商流量红利的枯竭,零售行业又一次面临着转型。正是在这样的大背景之下,新零售开始出现,泰山众筹系统开发详解:I8O-2857-8624新零售带来的是零售行业发展遭遇瓶颈之后的一个全新的解决方案。相信在新零售完成对零售行业的升级之后,我们的生活方式也将发生巨大的变化。
去中心化应用,又称DApp(Decentrliazed Application) 传统应用架构示例Web3.0则是“轻”后端“重”前端,指的是少调用或者不调用后端,前端直接与区块链交互,因为区块链拥有数据防篡改、多副本、接入方便(针对公有链)等优势,因此,可以防止出现因服务器宕机导致无法使用应用的情况。区块链业内有句话:只要给我一个前端,就可以干掉所有后端。话虽然极短,但意思已经表达很清楚了。
DApp架构示例1)分布式存储
区块链是Web3.0组成的一部分,还有其他的,比如存储。Web3.0强调的是去中心化,因此,数据的存储一定也是去中心化的。目前,业内做最好的是IPFS,很多公司也会利用IPFS,结合激励模式来吸引用户参与分布式存储,比如Filecoin。
IPFS+Filecoin
2)NFT
NFT是不可复刻的,是唯一的,在Web3.0中这点很重要,它能真实反映用户在去中心化世界资产所有权问题。在未来,NFT也将会成为现实生活中的物品在区块链上的映射产物。NFT能够真真正正贴合Web3.0的精神——关注用户个人权益和价值。
3)去中心化组织,又称DAO(Decentralized Autonomous Organization)
新物种崛起主要包括以下几个方面:
(一)、Expand the online home business within the store coverage with app;
(二)、Improve the proportion of fresh food and introduce medium and high-end fresh food;
(三)、Set up food stalls and support buy now,cook now and eat now;
(四)、Adjust layout and moving line to enhance user experience;
(五)、The commodity positioning is refined and the customer group structure is younger.
import math
import numpy as np
#所有公式都call put二分,为了方便计算曲面
def callvalue(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
df=math.exp(-r*dt)
u=math.exp(sigma*math.sqrt(dt))
d=1/u
p=(math.exp(r*dt)-d)/(u-d)
mu=np.arange(M+1)
mu=np.resize(mu,(M+1,M+1))
md=np.transpose(mu)
mu=u**(mu-md)
md=d**md
uds=S0mumd
node=np.maximum(uds-K,0)
z=0
for t in range(M-1,-1,-1):
node[0:M-z,t]=(pnode[0:M-z,t+1]+(1-p)node[1:M-z+1,t+1])*df
z+=1
return node[0,0]
def putvalue(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
df=math.exp(-r*dt)
u=math.exp(sigma*math.sqrt(dt))
d=1/u
p=(math.exp(r*dt)-d)/(u-d)
mu=np.arange(M+1)
mu=np.resize(mu,(M+1,M+1))
md=np.transpose(mu)
mu=u**(mu-md)
md=d**md
uds=S0mumd
node=np.maximum(K-uds,0)
z=0
for t in range(M-1,-1,-1):
node[0:M-z,t]=(pnode[0:M-z,t+1]+(1-p)node[1:M-z+1,t+1])*df
z+=1
return node[0,0]
#Binomial Greeks
#1 on S
def calldelta(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
delta=(callvalue(S0u,K,t,T-dt,r,sigma,M-1)-callvalue(S0d,K,t,T-dt,r,sigma,M-1))/(S0u-S0d)
return delta
def putdelta(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
delta=(putvalue(S0u,K,t,T-dt,r,sigma,M-1)-putvalue(S0d,K,t,T-dt,r,sigma,M-1))/(S0u-S0d)
return delta
#1-1 on S on S
def callgamma(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
gamma=(calldelta(S0u,K,t,T-dt,r,sigma,M-1)-calldelta(S0d,K,t,T-dt,r,sigma,M-1))/(0.5S0(uu-dd))
return gamma
def putgamma(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
gamma=(putdelta(S0u,K,t,T-dt,r,sigma,M-1)-putdelta(S0d,K,t,T-dt,r,sigma,M-1))/(0.5S0(uu-dd))
return gamma
#1-1-1 on S on S on S
def callspeed(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
speed=(callgamma(S0u,K,t,T-dt,r,sigma,M-1)-callgamma(S0d,K,t,T-dt,r,sigma,M-1))/(0.5S0(uu-dd))
return speed
def putspeed(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
speed=(putgamma(S0u,K,t,T-dt,r,sigma,M-1)-putgamma(S0d,K,t,T-dt,r,sigma,M-1))/(0.5S0(uu-dd))
return speed
#1-1-2 on S on S on Sigma
def callzomma(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
zomma=(callgamma(S0,K,t,T,r,sigma1.01,M)-callgamma(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return zomma
def putzomma(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
zomma=(putgamma(S0,K,t,T,r,sigma1.01,M)-putgamma(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return zomma
#1-1-3 on S on S on T
def callcolor(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
color=(callgamma(S0,K,t,T-2dt,r,sigma,M-2)-callgamma(S0,K,t,T,r,sigma,M))/(2dt)
return color
def putcolor(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
color=(putgamma(S0,K,t,T-2dt,r,sigma,M-2)-putgamma(S0,K,t,T,r,sigma,M))/(2dt)
return color
#1-2 on S on Sigma
def callvanna(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
vanna=(callvega(S0u,K,t,T-dt,r,sigma,M-1)-callvega(S0d,K,t,T-dt,r,sigma,M-1))/(S0u-S0d)
return vanna
def putvanna(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
u=math.exp(sigma*math.sqrt(dt))
d=1/u
vanna=(putvega(S0u,K,t,T-dt,r,sigma,M-1)-putvega(S0d,K,t,T-dt,r,sigma,M-1))/(S0u-S0d)
return vanna
#1-3 on S on T
def callcharm(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
charm=(calldelta(S0,K,t,T-2dt,r,sigma,M-2)-calldelta(S0,K,t,T,r,sigma,M))/(2dt)
return charm
def putcharm(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
charm=(putdelta(S0,K,t,T-2dt,r,sigma,M-2)-putdelta(S0,K,t,T,r,sigma,M))/(2dt)
return charm
#2 on Sigma
def callvega(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
vega=(callvalue(S0,K,t,T,r,sigma1.01,M)-callvalue(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return vega
def putvega(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
vega=(putvalue(S0,K,t,T,r,sigma1.01,M)-putvalue(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return vega
#2-1 on Sigma on S
#vanna already have on#1-2
#2-2 on Sigma on Sigma
def callvolga(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
volga=(callvega(S0,K,t,T,r,sigma1.01,M)-callvega(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return volga
def putvolga(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
volga=(putvega(S0,K,t,T,r,sigma1.01,M)-putvega(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return volga
#2-2-2 on Sigma on Sigma on Sigma
def callultima(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
ultima=(callvolga(S0,K,t,T,r,sigma1.01,M)-callvolga(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return ultima
def putultima(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
ultima=(putvolga(S0,K,t,T,r,sigma1.01,M)-putvolga(S0,K,t,T,r,sigma0.99,M))/(sigma1.01-sigma0.99)
return ultima
#2-3 on Sigma on T
def callveta(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
veta=(callvega(S0,K,t,T-2dt,r,sigma,M-2)-callvega(S0,K,t,T,r,sigma,M))/(2dt)
return veta
def putveta(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
veta=(putvega(S0,K,t,T-2dt,r,sigma,M-2)-putvega(S0,K,t,T,r,sigma,M))/(2dt)
return veta
#3 on T
def calltheta(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
theta=(callvalue(S0,K,t,T-2dt,r,sigma,M-2)-callvalue(S0,K,t,T,r,sigma,M))/(2dt)
return theta
def puttheta(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
dt=T/M
theta=(putvalue(S0,K,t,T-2dt,r,sigma,M-2)-putvalue(S0,K,t,T,r,sigma,M))/(2dt)
return theta
#4 on r
def callrho(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
rho=(callvalue(S0,K,t,T,r1.01,sigma,M)-callvalue(S0,K,t,T,r0.99,sigma,M))/(r1.01-r0.99)
return rho
def putrho(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
rho=(putvalue(S0,K,t,T,r1.01,sigma,M)-putvalue(S0,K,t,T,r0.99,sigma,M))/(r1.01-r0.99)
return rho
#4-2 on r on Sigma
#or named Rhova
def callvera(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
vera=(callrho(S0,K,t,T,r1.01,sigma,M)-callrho(S0,K,t,T,r0.99,sigma,M))/(r1.01-r0.99)
return vera
def putvera(S0,K,t,T,r,sigma,M):
S0:float
K:float
T:float
r:float
sigma:float
M:int
vera=(putrho(S0,K,t,T,r1.01,sigma,M)-putrho(S0,K,t,T,r0.99,sigma,M))/(r1.01-r0.99)
return vera
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)