Backtrader 文档学习-Platform Concepts

Backtrader 文档学习-Platform Concepts

1.开始之前

导入backtrader ,以及backtrader 的指示器、数据反馈的模块 。

import backtrader as bt
import backtrader.indicators as btind
import backtrader.feeds as btfeeds

看看btind模块下有什么方法和属性:

obj_str = ''
for i in dir(btind):
    if i[:1] != '_' :
        obj_str += i + ','    
print(obj_str)

指示器中的指标函数很多,方法属性如下:

ADX,ADXR,AO,APO,ATR,AbsPriceOsc,AbsolutePriceOscillator,AccDeOsc,AccelerationDecelerationOscillator,Accum,AdaptiveMovingAverage,AdaptiveMovingAverageEnvelope,AdaptiveMovingAverageOsc,AdaptiveMovingAverageOscillator,All,AllN,And,Any,AnyN,ApplyN,ArithmeticMean,AroonDown,AroonIndicator,AroonOsc,AroonOscillator,AroonUp,AroonUpDown,AroonUpDownOsc,AroonUpDownOscillator,Average,AverageDirectionalMovementIndex,AverageDirectionalMovementIndexRating,AverageTrueRange,AverageWeighted,AwesomeOsc,AwesomeOscillator,BBands,BaseApplyN,BollingerBands,BollingerBandsPct,CCI,Cmp,CmpEx,CointN,CommodityChannelIndex,CrossDown,CrossOver,CrossUp,CumSum,CumulativeSum,DEMA,DEMAEnvelope,DEMAOsc,DEMAOscillator,DI,DM,DMA,DMAEnvelope,DMAOsc,DMAOscillator,DMI,DPO,DV2,DemarkPivotPoint,DetrendedPriceOscillator,DicksonMA,DicksonMAEnvelope,DicksonMAOsc,DicksonMAOscillator,DicksonMovingAverage,DicksonMovingAverageEnvelope,DicksonMovingAverageOsc,DicksonMovingAverageOscillator,DirectionalIndicator,DirectionalMovement,DirectionalMovementIndex,DivByZero,DivZeroByZero,DoubleExponentialMovingAverage,DoubleExponentialMovingAverageEnvelope,DoubleExponentialMovingAverageOsc,DoubleExponentialMovingAverageOscillator,DownDay,DownDayBool,DownMove,EC,ECEnvelope,ECOsc,ECOscillator,EMA,EMAEnvelope,EMAOsc,EMAOscillator,Envelope,EnvelopeMixIn,ErrorCorrecting,ErrorCorrectingEnvelope,ErrorCorrectingOsc,ErrorCorrectingOscillator,ExpSmoothing,ExpSmoothingDynamic,ExponentialMovingAverage,ExponentialMovingAverageEnvelope,ExponentialMovingAverageOsc,ExponentialMovingAverageOscillator,ExponentialSmoothing,ExponentialSmoothingDynamic,FibonacciPivotPoint,FindFirstIndex,FindFirstIndexHighest,FindFirstIndexLowest,FindLastIndex,FindLastIndexHighest,FindLastIndexLowest,HMA,HMAEnvelope,HMAOsc,HMAOscillator,HeikinAshi,Highest,HullMA,HullMAEnvelope,HullMAOsc,HullMAOscillator,HullMovingAverage,HullMovingAverageEnvelope,HullMovingAverageOsc,HullMovingAverageOscillator,Hurst,HurstExponent,Ichimoku,If,Indicator,KAMA,KAMAEnvelope,KAMAOsc,KAMAOscillator,KST,KnowSureThing,LAGF,LRSI,LaguerreFilter,LaguerreRSI,LineActions,List,Logic,Lowest,MACD,MACDHisto,MACDHistogram,MAXINT,Max,MaxN,Mean,MeanDev,MeanDeviation,MetaMovAvBase,Min,MinN,MinusDI,MinusDirectionalIndicator,ModifiedMovingAverage,ModifiedMovingAverageEnvelope,ModifiedMovingAverageOsc,ModifiedMovingAverageOscillator,Momentum,MomentumOsc,MomentumOscillator,MovAv,MovingAverage,MovingAverageAdaptive,MovingAverageAdaptiveEnvelope,MovingAverageAdaptiveOsc,MovingAverageAdaptiveOscillator,MovingAverageBase,MovingAverageDoubleExponential,MovingAverageDoubleExponentialEnvelope,MovingAverageDoubleExponentialOsc,MovingAverageDoubleExponentialOscillator,MovingAverageExponential,MovingAverageExponentialEnvelope,MovingAverageExponentialOsc,MovingAverageExponentialOscillator,MovingAverageSimple,MovingAverageSimpleEnvelope,MovingAverageSimpleOsc,MovingAverageSimpleOscillator,MovingAverageSmoothed,MovingAverageSmoothedEnvelope,MovingAverageSmoothedOsc,MovingAverageSmoothedOscillator,MovingAverageTripleExponential,MovingAverageTripleExponentialEnvelope,MovingAverageTripleExponentialOsc,MovingAverageTripleExponentialOscillator,MovingAverageWeighted,MovingAverageWeightedEnvelope,MovingAverageWeightedOsc,MovingAverageWeightedOscillator,MovingAverageWilder,MovingAverageWilderEnvelope,MovingAverageWilderOsc,MovingAverageWilderOscillator,MultiLogic,MultiLogicReduce,NZD,NonZeroDifference,OLS_BetaN,OLS_Slope_InterceptN,OLS_TransformationN,OperationN,Or,Oscillator,OscillatorMixIn,PGO,PPO,PPOShort,PSAR,ParabolicSAR,PctChange,PctRank,PercPriceOsc,PercPriceOscShort,PercentChange,PercentRank,PercentagePriceOscillator,PercentagePriceOscillatorShort,PeriodN,PivotPoint,PlusDI,PlusDirectionalIndicator,PrettyGoodOsc,PrettyGoodOscillator,PriceOsc,PriceOscillator,RMI,ROC,ROC100,RSI,RSI_Cutler,RSI_EMA,RSI_SMA,RSI_SMMA,RSI_Safe,RSI_Wilder,RateOfChange,RateOfChange100,Reduce,ReduceN,RelativeMomentumIndex,RelativeStrengthIndex,SMA,SMAEnvelope,SMAOsc,SMAOscillator,SMMA,SMMAEnvelope,SMMAOsc,SMMAOscillator,SimpleMovingAverage,SimpleMovingAverageEnvelope,SimpleMovingAverageOsc,SimpleMovingAverageOscillator,SmoothedMovingAverage,SmoothedMovingAverageEnvelope,SmoothedMovingAverageOsc,SmoothedMovingAverageOscillator,StandardDeviation,StdDev,Stochastic,StochasticFast,StochasticFull,StochasticSlow,Sum,SumN,TEMA,TEMAEnvelope,TEMAOsc,TEMAOscillator,TR,TRIX,TSI,TripleExponentialMovingAverage,TripleExponentialMovingAverageEnvelope,TripleExponentialMovingAverageOsc,TripleExponentialMovingAverageOscillator,Trix,TrixSignal,TrueHigh,TrueLow,TrueRange,TrueStrengthIndicator,UltimateOscillator,UpDay,UpDayBool,UpMove,Vortex,WMA,WMAEnvelope,WMAOsc,WMAOscillator,WeightedAverage,WeightedMovingAverage,WeightedMovingAverageEnvelope,WeightedMovingAverageOsc,WeightedMovingAverageOscillator,WilderMA,WilderMAEnvelope,WilderMAOsc,WilderMAOscillator,WilliamsAD,WilliamsR,ZLEMA,ZLEMAEnvelope,ZLEMAOsc,ZLEMAOscillator,ZLInd,ZLIndEnvelope,ZLIndOsc,ZLIndOscillator,ZLIndicator,ZLIndicatorEnvelope,ZLIndicatorOsc,ZLIndicatorOscillator,ZeroLagEma,ZeroLagEmaEnvelope,ZeroLagEmaOsc,ZeroLagEmaOscillator,ZeroLagExponentialMovingAverage,ZeroLagExponentialMovingAverageEnvelope,ZeroLagExponentialMovingAverageOsc,ZeroLagExponentialMovingAverageOscillator,ZeroLagIndicator,ZeroLagIndicatorEnvelope,ZeroLagIndicatorOsc,ZeroLagIndicatorOscillator,absolute_import,accdecoscillator,alias,aroon,atr,awesomeoscillator,basicops,bollinger,bt,cci,cmp,contrib,crossover,dema,deviation,directionalmove,division,dma,dpo,dv2,ema,envelope,functools,haD,haDelta,hadelta,heikinashi,hma,hurst,ichimoku,kama,kst,linename,lrsi,mabase,macd,map,math,module,momentum,movav,movname,newaliases,newcls,newclsdct,newclsdoc,newclsname,ols,operator,oscillator,percentchange,percentrank,pivotpoint,prettygoodoscillator,priceoscillator,print_function,psar,range,rmi,rsi,sma,smma,stochastic,suffix,sys,trix,tsi,ultimateoscillator,unicode_literals,williams,with_metaclass,wma,zlema,zlind,

也可以直接通过bt导入下面的模块feeds indicators

import backtrader as bt
thefeed = bt.feeds.OneOfTheFeeds(...)
theind = bt.indicators.SimpleMovingAverage(...)

2.数据读入-无处不在

所有的策略都基于数据,平台端用户不用考虑如何接收数据。

Data Feeds are automagically provided member variables to the strategy in the form of an array and shortcuts to the array positions

数据源是以数组的形式或者对数组位置快捷访问的方式提供给strategy(策略)作为成员变量使用的。
这句话需要好好理解。

数组的形式: self.datas[0].close
数组位置快捷访问:self.data0.close

class MyStrategy(bt.Strategy):
    params = dict(period=20)

    def __init__(self):

        sma = btind.SimpleMovingAverage(self.datas[0], period=self.params.period)
        print(sma)
        # Keep a reference to the "close" line in the data[0] dataseries
        self.dataclose = self.datas[0].close
        self.dataclosetest = self.data0.close

        print('-'* 20,'close','-' * 20 )
        print(self.dataclose[0])
        print(self.dataclosetest[0])        

执行结果
sma 的数据类型backtrader.indicators.sma.SimpleMovingAverage

<backtrader.indicators.sma.SimpleMovingAverage object at 0x7f616bd7c820>
-------------------- close --------------------
133.01
133.01

Data Feeds get added to the platform and they will show up inside the strategy in the sequential order in which they were added to the system.

SQL语句按日期排序,不论是正序还是逆序desc ,到BackTrader中,都是按时间倒序排列,[0]是最后的日期。

3.快捷访问数据

self.datas数组项可以通过自动成员变量直接访问:

self.data targets self.datas[0]
self.dataX targets self.datas[X]

下面好好测试一下BackTrader的数据访问,数据之间的关系。

#<class 'backtrader.linebuffer.LineBuffer'>
print(type(cerebro.datas[0].close))

#<class 'backtrader.feeds.pandafeed.PandasData'>
print(type(cerebro.datas[0]))

#<class 'list'>
print(type(cerebro.datas))

# ('close', 'low', 'high', 'open', 'volume', 'openinterest', 'datetime')
print(cerebro.datas[0].getlinealiases())

结果如下:

<class 'backtrader.linebuffer.LineBuffer'>
<class 'backtrader.feeds.pandafeed.PandasData'>
<class 'list'>
('close', 'low', 'high', 'open', 'volume', 'openinterest', 'datetime')

在这里插入图片描述

说明:

  • 1、cerebro.datas数据集的类型是 <class ‘list’> ,对应载入cerebro的股票数据,可以是多个股票,就是股票的集合。
  • 2、cerebro.datas[0]是<class ‘backtrader.feeds.pandafeed.PandasData’>,其实与dataframe类似,包括以下列:(‘close’, ‘low’, ‘high’, ‘open’, ‘volume’, ‘openinterest’, ‘datetime’)的集合。
    -3、cerebro.datas[0].close就是dataframe的一列数据,BackTrader称之为Line <class ‘backtrader.linebuffer.LineBuffer’> 。
  • 4、cerebro.datas[0].close[0] 就是访问到数据的元素,实际数据值。
  • 5、cerebro.datas[0]都是按时间顺序逆序的,第一个元素index是0 ,下一个是-1 ,以此类推。
  • 6、时间序列必须用内置方法处理
print(cerebro.datas[0].datetime[0]) 
print(pd.to_datetime(cerebro.datas[0].datetime[0],unit='s'))
print(bt.num2date(cerebro.datas[0].datetime[0]))

结果如下:

737424.0
1970-01-09 12:50:24
2019-12-31 00:00:00

直接访问datetime列 ,是浮点数。
开始用pd.to_datetime 函数,转换的时间是1970年,迷惑很长时间。

重要:必须用自带的函数转换时间 bt.num2date()!!!

4.默认数据载入

class MyStrategy(bt.Strategy):
    params = dict(period=20)

    def __init__(self):

        sma = btind.SimpleMovingAverage(period=self.params.period)

    ...

self.data has been completely removed from the invocation of SimpleMovingAverage. If this is done, the indicator (in this case the SimpleMovingAverage) receives the first data of the object in which is being created (the Strategy), which is self.data (aka self.data0 or self.datas[0])

默认使用的self是什么?
如果只有一个数据源,cerebro只载入一个股票数据,不用显式指定,系统会缺省使用self.datas[0],self.data=self.data0=self.datas[0] ,也就是第一个加入的数据源 。所以说self.data 就没有显式出现在调用SMA指示器 。
如果有多个载入数据,还是注明好,清晰可读。

5. 一切都是数据载入

class MyStrategy(bt.Strategy):
    #定义策略全局参数
    params = dict(period1=20, period2=25, period3=10, period4)

    def __init__(self):
        # 使用SMA指示器载入datas[0],使用参数1
        sma1 = btind.SimpleMovingAverage(self.datas[0], period=self.p.period1)

        # This 2nd Moving Average operates using sma1 as "data"
        # 使用第一个SMA指示器数据再次作为SMA的数据载入,使用参数2
        sma2 = btind.SimpleMovingAverage(sma1, period=self.p.period2)

        # New data created via arithmetic operation
        # 随意的计算  
        something = sma2 - sma1 + self.data.close

        # This 3rd Moving Average operates using something  as "data"
        # 随意计算的结果作为第三次SMA数据载入,使用参数3
        sma3 = btind.SimpleMovingAverage(something, period=self.p.period3)

        # Comparison operators work too ...
        # 比较后取大值 ,有点疑问 ?
        greater = sma3 > sma1

        # Pointless Moving Average of True/False values but valid
        # This 4th Moving Average operates using greater  as "data"
        # 比较后结果第四次载入SMA指示器,使用参数4
        sma3 = btind.SimpleMovingAverage(greater, period=self.p.period4)

    ...

总而言之,所有的数据转换变化后,都可以作为数据载入,再次进行运算。

6. 参数

在backtrader中,所有的类都按照如下方法来使用参数:

1、声明一个带有缺省值的参数作为类的一个属性(元组或者字典结构)。
2、关键字类型参数(kwargs)会扫描匹配的参数,将值赋值给对应的参数,完成后从kwargs删除。
3、这些参数都可以在类实例中通过访问成员变量self.params(可以简写为self.p)来使用。
使用元组 tuple

class MyStrategy(bt.Strategy):
    params = (('period', 20),)

    def __init__(self):
        sma = btind.SimpleMovingAverage(self.data, period=self.p.period)

使用字典dict

class MyStrategy(bt.Strategy):
    params = dict(period=20)

    def __init__(self):
        sma = btind.SimpleMovingAverage(self.data, period=self.p.period)

7.Lines 关键的概念

从使用用户(通常是strategy)的角度来说,就是包括一个或多个line,这些line是一系列的数据,在图中可以形成一条线(line)。line是数组,不是pd.series ,没有index 。

class MyStrategy(bt.Strategy):
    params = dict(period=20)

    def __init__(self):

        self.movav = btind.SimpleMovingAverage(self.data, period=self.p.period)

    def next(self):
        if self.movav.lines.sma[0] > self.data.lines.close[0]:
            print(round(self.movav.lines.sma[0],2),self.data.lines.close[0],'Simple Moving Average is greater than the closing price')

执行结果:

83.34 74.4 Simple Moving Average is greater than the closing price
83.16 75.1 Simple Moving Average is greater than the closing price
83.01 76.6 Simple Moving Average is greater than the closing price
82.92 80.1 Simple Moving Average is greater than the closing price
82.82 79.64 Simple Moving Average is greater than the closing price
82.69 78.52 Simple Moving Average is greater than the closing price
82.36 76.1 Simple Moving Average is greater than the closing price
81.87 74.28 Simple Moving Average is greater than the closing price
... ... 

self.movav:这个是一个SimpleMovingAverage的指标(indicator),本身就包含一个具有lines属性的sma。这里特殊注意一下,计算SimpleMovingAverage使用的self.data,没有指定具体Line的话,缺省用的是close价进行计算。

简单的方法访问lines:

xxx.lines 可以简化为 xxx.l
xxx.lines.name可以简化为xxx.lines_name

一些复杂的对象也可以通过如下方法访问:

self.data_name 等于 self.data.lines.name

如果有多个变量的话,也可以self.data1_name 替代self.data1.lines.name

此外,Line的名字也可以通过如下方式访问:

self.data.close and self.movav.sma

class MyStrategy(bt.Strategy):
    params = dict(period=20)

    def __init__(self):

        self.movav = btind.SimpleMovingAverage(self.data, period=self.p.period)

    def next(self):
        # 数据集0 收盘价在110和120
        if (self.datas[0].close[0] > 110.0) & (self.datas[0].close[0] < 120.0):
            print(bt.num2date(self.datas[0].datetime[0]),'self.datas[0].close[0] > 110.0')
        
        # 数据集1 收盘价在110和120    
        if self.datas[1].close[0] > 9.0:
            print(bt.num2date(self.datas[1].datetime[0]),'self.datas[1].close[0] > 9.0')
        
        # 数据集SMA 收盘价在88和90
        if (self.movav.lines.sma[0] > 88) & (self.movav.sma[0] < 90) :
            print(round(self.movav.lines.sma[0],2),'self.movav.lines.sma[0] > 88')
            print(self.movav.getlinealiases())
            #print(cerebro.datas[0].getlinealiases())

结果如下:

2018-04-18 00:00:00 self.datas[1].close[0] > 9.0
2018-04-24 00:00:00 self.datas[1].close[0] > 9.0
2018-04-25 00:00:00 self.datas[1].close[0] > 9.0
2018-04-26 00:00:00 self.datas[1].close[0] > 9.0
2019-04-09 00:00:00 self.datas[0].close[0] > 110.0
88.78 self.movav.lines.sma[0] > 88
('sma',)
89.64 self.movav.lines.sma[0] > 88
('sma',)
2019-06-20 00:00:00 self.datas[0].close[0] > 110.0
2019-06-21 00:00:00 self.datas[0].close[0] > 110.0
2019-06-24 00:00:00 self.datas[0].close[0] > 110.0
2019-06-25 00:00:00 self.datas[0].close[0] > 110.0
2019-06-26 00:00:00 self.datas[0].close[0] > 110.0
2019-06-27 00:00:00 self.datas[0].close[0] > 110.0
2019-06-28 00:00:00 self.datas[0].close[0] > 110.0
2019-07-24 00:00:00 self.datas[0].close[0] > 110.0
2019-08-01 00:00:00 self.datas[0].close[0] > 110.0
2019-08-02 00:00:00 self.datas[0].close[0] > 110.0
2019-08-05 00:00:00 self.datas[0].close[0] > 110.0
2019-08-07 00:00:00 self.datas[0].close[0] > 110.0
2019-08-09 00:00:00 self.datas[0].close[0] > 110.0

需要好好说明一下:

  • 简写示例

if (self.movav.lines.sma[0] > 88) & (self.movav.sma[0] < 90) :

  • 多数据源

两种方式引用
self.movav.lines.sma[0] = self.movav.sma[0]

cerebro载入两个股票数据。
特别注意:调用datas ,有s
self.datas[0].close[0]
self.datas[0].close[0]
self.datas[0].close[0]

  • SMA指示器调用后,是数组,没有日期字段!!!
    开始也想增加打印日期,

print(bt.num2date(self.movav.datetime[0]) 无日期

只有一列

print(self.movav.getlinealiases())
('sma',)

未完待续!!!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mfbz.cn/a/241872.html

如若内容造成侵权/违法违规/事实不符,请联系我们进行投诉反馈qq邮箱809451989@qq.com,一经查实,立即删除!

相关文章

SpringBoot3-实现和注册拦截器

1、pom.xml <?xml version"1.0" encoding"UTF-8"?> <project xmlns"http://maven.apache.org/POM/4.0.0"xmlns:xsi"http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation"http://maven.apache.org/POM/4.0.…

sylar高性能服务器-配置(P12-p14)内容记录

文章目录 p12&#xff1a;复杂类型解析一、方法函数二、结果展示 p13&#xff1a;复杂类型解析完善一、方法函数二、结果展示 p14&#xff1a;自定义类型解析一、方法函数二、小结 p12&#xff1a;复杂类型解析 ​ 本节内容主要针对完了配置类中对于复杂类型的转换。之前只实现…

JAVAEE-8-线程池

池 我们之前也接触过,比如说常量池,数据库连接池,线程池,进程池,内存池等等, 池的共性: 1.提前把要用的对象准备好 2.把用完的对象也不要立即释放,先留着以备下次使用 来提高效率!!! 最开始,进程能够解决并发编程的问题,因为频繁创建销毁进程的开销成本太大了,所以我们引…

【Jenkins】Centos环境安装Jenkins(通过docker安装)

通过docker环境安装Jenkins 参考官网 https://hub.docker.com/r/jenkins/jenkins/ 1、安装docker环境 # 删除已有安装包 sudo yum remove docker \docker-client \docker-client-latest \docker-common \docker-latest \docker-latest-logrotate \docker-logrotate \docker-…

正确看待鸿蒙不兼容Android,这不是趋势?

华为可能明年推出不兼容安卓的鸿蒙版本。11月20日&#xff0c;据澎湃新闻报道&#xff0c;一华为相关人士表示&#xff0c;推出时间还不确定&#xff0c;未来IOS、鸿蒙、安卓将为三个各自独立的系统。 稍早前据证券时报报道&#xff0c;有业内人士亦表示&#xff1a;“华为内部…

测试面试必备:HTTP请求和响应详解!

一次完整的HTTP请求过程从TCP三次握手建立连接成功后开始&#xff0c;客户端按照指定的格式开始向服务端发送HTTP请求&#xff0c;服务端接收请求后&#xff0c;解析HTTP请求&#xff0c;处理完业务逻辑&#xff0c;最后返回一个HTTP的响应给客户端&#xff0c;HTTP的响应内容同…

Ubuntu与Windows通讯传输文件(FTP服务器版)(没用的方法,无法施行)

本文介绍再Windows主机上建立FTP服务器&#xff0c;并且在Ubuntu虚拟机上面访问Windows上FTP服务器的方法 只要按照上图配置就可以了 第二部&#xff1a;打开IIS管理控制台 右击网站&#xff0c;新建FTP站点。需要注意的一点是在填写IP地址的时候&#xff0c;只需要填写Window…

matlab操作方法(三)——matlab中的数字图像(读取、显示、保存)

数字图像是二维图像用有限数字数值像素的表示。通常像素在计算机中保存为二维整数数组的光栅图像&#xff0c;这些值经常用压缩格式进行传输和存储。 二值图像&#xff1a;图像中每个像素的亮度值仅可以取自0或1的图像&#xff0c;因此也称为1bit图像 灰度图像&#xff1a;图…

【数据结构】贪心算法

一.贪心算法的定义 贪心算法是指在对问题求解时&#xff0c;总是做出在当前看来是最好的选择。也就是说&#xff0c;不从整体最优上加以考虑&#xff0c;只做出在某种意义上的局部最优解。 贪心算法的结果是最优解的最好近似。 优点&#xff1a;简单&#xff0c;高效。 缺点&…

《Mamba: Linear-Time Sequence Modeling with Selective State Spaces》阅读笔记

论文标题 《Mamba: Linear-Time Sequence Modeling with Selective State Spaces》 利用选择性状态空间的线性时间序列建模 作者 Albert Gu 和 Tri Dao Albert Gu 来自卡内基梅隆大学机器学习系&#xff0c;Mamba 脱胎于 Albert Gu 的前作 S4 架构。 Tri Dao 来自普林斯顿…

赛氪为第五届全球校园人工智能算法精英大赛决赛提供技术支持

12月10日&#xff0c;以“智青春算未来”为主题的2023年第五届全球校园人工智能算法精英大赛全国总决赛在河海大学江宁校区举行。本次大赛由江苏省人工智能学会主办&#xff0c;自9月份启动以来&#xff0c;共吸引了全国近400所高校的3000多支参赛团队参加。经过校赛、省赛选拔…

C语言:高精度除法(除低精度)

P1480 A/B Problem - 洛谷 | 计算机科学教育新生态 (luogu.com.cn) 由图知&#xff0c;被除数的上一位的余数乘10加这位就是这一位结果的除数。 c[i] (d * 10 a[i]) / b #include<stdio.h> #include<string.h> char x[50005];//存储被除数&#xff0c;转为字符…

二百一十七、Flume——Flume拓扑结构之聚合的开发案例(亲测,附截图)

一、目的 对于Flume的聚合拓扑结构&#xff0c;进行一个开发测试 二、聚合 &#xff08;一&#xff09;结构含义 这种模式是我们最常见的&#xff0c;也非常实用。日常web应用通常分布在上百个服务器&#xff0c;大者甚至上千个、上万个服务器产生的日志&#xff0c;处理起来…

Java基础:如何创建多层文件夹

一、单层多个 代码实现如下&#xff1a; public class Main {public static void main(String[] args) {//在D盘中创建File file new File("D:"File.separator"docum");file.mkdir();//在D盘中的docum目录中创建file new File("D:\\docum" Fi…

[pasecactf_2019]flask_ssti proc ssti config

其实这个很简单 Linux的/proc/self/学习-CSDN博客 首先ssti 直接fenjing一把锁了 这里被加密后 存储在 config中了 然后我们去config中查看即可 {{config}} 可以获取到flag的值 -M7\x10wd94\x02!-\x0eL\x0c;\x07(DKO\r\x17!2R4\x02\rO\x0bsT#-\x1cZ\x1dG然后就可以写代码解…

Vue表格自定义合计、小计功能

一、合计 <template> <avue-crud:option"optiondata":table-loading"loading":data"testdata":page.sync"page":span-method"spanMethod"ref"cruddata"current-change"currentChangedata"si…

Unity | Shader基础知识(第四集:Shader结构体)

一、本节介绍 上一集&#xff0c;我们做了一个案例&#xff0c;这一集&#xff0c;我们继续讲一个语法&#xff0c;在shader里写结构体。 二、结构体的需求 1.shader里是不好随便去声明数据的&#xff0c;我们前面传入数据时&#xff0c;用的是括号传入&#xff08;如图&…

Redis怎么测?这篇文章写的太全了

Redis是一个高性能、内存数据库和缓存系统&#xff0c;在开发和生产环境中被广泛应用。本文将介绍如何进行有效的Redis软件测试&#xff0c;以确保其稳定性、高性能和可靠性。 Redis作为一种非关系型数据库和缓存系统&#xff0c;被广泛用于支持高流量、低延迟的应用。为了保证…

iic应用篇

一.iic的优点 1. IIC总线物理链路简单&#xff0c;硬件实现方便&#xff0c;扩展性非常好&#xff08;1个主机控制器可以根据需求增加从机数量&#xff0c;同时删减从机数量也不会影响总线通信&#xff09;&#xff1b;IIC总线只需要SDA和SCL两条信号线&#xff0c;相比于PCI/…

锂电池基础知识及管理方式总结

这两天在排查一个锂电池无法充电的问题&#xff0c;用的是电池管理芯片BQ25713&#xff0c;网上相关的资料也很少&#xff0c;查看数据手册时&#xff0c;里面也有很多术语参数等不是很理解&#xff0c;所以&#xff0c;在此对锂电池的基础知识做个简单的总结&#xff0c;方面后…