- 如果当前价格大于均线,就买买买。
- 若低于移动均线,则卖出为什么这听起来像是追涨杀跌?看起来我们的机器人就像一棵大葱。
[En]
Simple Sidebar
The starting state of the menu will appear collapsed on smaller screens, and will appear non-collapsed on larger screens. When toggled using the button below, the menu will change.
Make sure 量化投资之工具篇 to keep all page content within 量化投资之工具篇 the #page-content-wrapper . The top navbar is optional, and just for demonstration. Just create 量化投资之工具篇 an element with the #sidebarToggle ID which will toggle the menu when clicked.
3、手把手教你实现一个例子
用了很多年Linux的我在升级Ubuntu 16.04之后竟然发现我的以太网卡的名字竟然不是eth0,变成了enp3s0,每次想要修改什么配置,都要先ifconfig查一下网卡名,真是让我很郁闷!去网上搜索一下才知道,这次的Ubuntu 16的更新幅度很大,当属systemd替换掉了initd来引导系统这个动作给用户带来的影响最大,原来习惯service什么的来控制系统服务什么的,现在竟然被sys.
python中文处理之encode/decode函数_atongkui9780的博客-程序员宝宝
python中文处理相信迷惑过不少同学。下面说说python2/3的encode和decode函数。python2中,使用decode()和encode()来进行解码和编码,以unicode类型作为中间类型。即 decode encodestr ---------> unicode --------->str示例(注意encod.
centeros下设置zookeeper开机启动_心语_卿毅的博客-程序员宝宝
准备:记录java的安装路径和zookeeper的安装路径:java的安装路径 :/opt/java/jdk1.8.0_291zookeeper的安装路径: /opt/zookeeper_installed/apache-zookeeper-3.6.3-bin切换到/etc/rc.d/init.d/目录下创建zookeeper文件:touch zookeeper更新权限:chmod +x zookeeper编辑 文件,在zookeeper里面输入如下内容#!/bin/bash#chkcon
ActiveMQ的java操作_woshisunxiangfu的博客-程序员宝宝
on;import javax.jms.MessageConsumer;import javax.jms.MessageProducer;import javax.jms.Session;import javax.jms.TextMessage;import org.apache.activemq.ActiveMQConnection;import org.apache.activemq.ActiveMQConnectionFactory;import org.apache.lo
量化投资之工具篇
个人觉得还是都会比较好。技多不压身。量化投资用Matlab 量化投资之工具篇 和62616964757a686964616fe4b893e5b19e31333365666139 C++,一个建模一个执行,足够了。实在不爱用Matlab的话,R和Python也行。
选择python推荐可以阅读:《量化投资:以python为工具》主要讲解量化投资的思想和策略,并借助Python 语言进行实战。《量化投资:以Python为工具》一共分为5 部分,第1 部分是Python 入门,第2 部分是统计学基础,第3 部分是金融理论、投资组合与量化选股,第4 部分是时间序列简介与配对交易,第5 部分是技术指标与量化投资。《量化投资:以Python为工具》首先对Python 编程语言进行介绍,通过学习,读者可以迅速掌握用Python 语言处理数据的方法,并灵活运用Python 解决实际金融问题;其次,向读者介绍量化投资的理论知识,主要讲解量化投资所需的数量基础和类型等方面;最后讲述如何在Python 语言中构建量化投资策略。
Android Studio2.3和Gradle-3.3的升级和配置问题_绿叶清风的博客-程序员ITS301
前不久,Android Studio 2.3正式版发布了,该版本包含一些新特性,包括对WebP支持的更新;ConstraintLayout库支持更新和布局编辑器的部件面板;提供一个新的App Link助手可以帮助你在应用中构建URI的统一视图。在更新完之后,会提示gradle-3.3版本的更新,此时要注意几点: 1. 更新gradle的几个配置文件,都在你的项目目录下,一个是b
安信可 ESP8266 NodeMCU HTTP 通信 演示_wowocpp的博客-程序员ITS301
设置流程: http://bbs.ai-thinker.com/forum.php?mod=viewthread&tid=17 1.如何使用http通信 -&量化投资之工具篇 amp;amp;amp;amp;gt;这个问题就不详细阐述, 8266内部集成TCP/IP协议,http需要自行实现,贴个例子链接吧。 http://wiki.ai-thinker.com/esp8266/examples/at_demo中国移动OnetN.
mac电池最大充电限制工具:AlDente mac中文免费版_普通网友的博客-程序员ITS301
AlDente Mac版是一款调节 macOS 充电量阈值的小工具,能够帮助我们在给Macbook充电的时候最大限度的保护内置电池,并且能够通过一些简单的设置来降低因为充电造成的电池损耗,最大化地延长电池的使用寿命。AlDente 最新版软件介绍AlDente for mac是一款调节 macOS 充电量阈值的小工具,它可以限制mac最大充电百分比。经常插着电源充电有Mac book 用户,会发现电池循环次数很低,但是电池却损耗了很多可用度。因为锂电池并不适合一直保持满电和空电状态,在30%.
来学习R语言绘图啦~_作小寒的博客-程序员ITS301
# 两个包自己用Rstudio直接安装就好install.packages("tidyverse")library(tidyverse)mpg#> Loading tidyverse:ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy,color = "blue"))ggplot(data = mpg) + geom_point(mapping = aes(x = displ, y = hwy, sha
Xilinx Zynq-7000 嵌入式系统设计与实现_weixin_33750452的博客-程序员ITS301
Xilinx Zynq-7000 嵌入式系统设计与实现 基于ARM Cortex-A9双核处理器和Vivado的设计方法目录第1章Zynq-7000 SoC设计导论1.1全可编程片上系统基础知识1.1.1全可编程片上系统的演进1.1.2SoC与MCU和CPU的比较1.1.3全可编程SoC诞生的背景1.1.4可编程SoC系统技术特点1.1.5全可编程片上系统中的处理器类型.
3、手把手教你实现一个例子
No, why hasn’t the money changed? this robot doesn’t make money for me. Because the robot’s brain is just initialized, it hasn’t developed yet, its brain is 量化投资之工具篇 blank, and it can’t do anything, so it can’t make money naturally. Let’s first give the robot some stock 量化投资之工具篇 data to see, let him first look at the stock data, maybe he can learn something.
给空白的大脑加载数据
- 能接受股票的数据了。(这里提供的是下载浦发银行(sh6000000)的历史数据作为示例,如何获取数据后续专门讨论)
- 也能对datetime进行处理,根据需要看具体特定时期的数据了。
给大脑第一个策略
- Strategy初始化的时候,将大脑加载的数据更新到dataclose属性中(注意,这是一个列表,保存股票回测开始时间到结束时间的所有close数据)。 self.datas[0]指向的是大脑通过cerebro.adddata函数加载的第一个数据,本例中指加载浦发银行的股票数据。
- self.dataclose = self.datas[0].close指向的是close (收盘价)line
- strategy 的next方法针对self.dataclose(也就是收盘价Line)的每一行(也就是Bar)进行处理。在本例中,只是打印了下close的值。next方法是Strategy最重要的的方法,具体策略的实现都在这个函数中,后续还会详细介绍。
加入买的逻辑到Strategy中
If there is no sale, there is no income. Let’s start buying. When will we 量化投资之工具篇 buy? Mother said, to buy things cheaply, then if the price falls for 2 days in a row, we will buy, try!
- self.datas[0] 就是我们购买了的股票。本例中没有输入其他数据,如果输入了其他数据,购买的股票就不一定是啥了,这个要看具体的策略执行情况。
- 买了多少股本(stake)的股票?这个通过机器人大脑的position sizer属性来记录,缺省值为1,就是缺省咱们每一次操作只买卖1股。
- 当前order执行的时候,采用的价格是第二天的开盘价。
- 当前order执行的时候,没有收佣金。佣金如何设置后续还会说明。
不仅要买,还要卖
注意,如果我们不在市场内,就不能卖。什么叫不在市场内,就是你不拥有任何股票头寸,也就是没有买入资产。在策略中,通过 position 属性来记录。
- 访问postion获取是否在市场内
- 会创建买和卖的订单(order)
- 订单状态的改变会通过notify方法通知到strategy。
券商说,俺的钱呢?
The brokerage said, you buy and sell here, where is my commission? All right, let’s add the commission, 0.1%, one line of code:
2021-09-27, OPERATION PROFIT, GROSS -2.68, NET -2.94
如何给策略Strategy传递参数
Strategy is highly 量化投资之工具篇 量化投资之工具篇 configurable. If the brain wants to adjust the strategy, it can set it through configuration parameters to avoid a large amount of hard-coded data that is difficult to modify later. For example, the strategy was sold after 5 days, but now you want 量化投资之工具篇 to sell it again after 7 days, which can be achieved by modifying the parameters. How are parameters passed? It’s also simple:
After modifying these two places, let’s take a look (this change is relatively 量化投资之工具篇 simple, so we won’t post the code).
加一个指标(indicator)
When you invest, 量化投资之工具篇 you often hear about this indicator and that indicator, but you haven’t heard of it? Have you heard of the moving average? Let’s add 量化投资之工具篇 量化投资之工具篇 an EMA to guide our strategy. After 量化投资之工具篇 all, it’s too corny to fall 量化投资之工具篇 for two days in a row, and we need to use a high-end moving average:
- 如果当前价格大于均线,就买买买。 量化投资之工具篇
- 若低于移动均线,则卖出为什么这听起来像是追涨杀跌?看起来我们的机器人就像一棵大葱。
[En]
if it is below the moving average, sell it. Why does it sound like chasing the rise and killing the fall? it looks like our robot is like a leek.*