initial vault sync

This commit is contained in:
冯先生
2026-06-23 00:24:32 +08:00
commit 8e7723c17a
795 changed files with 157458 additions and 0 deletions

View File

@ -0,0 +1,23 @@
工程信息管理安全问题
### 1. 软件行业工程信息安全的隐患、原因及解决办法
以下结合实际案例,针对开发到运维各环节的典型隐患展开说明:
| 隐患类型 | 具体案例 | 存在原因 | 解决办法 |
| -------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ |
| 代码注入漏洞 | 登录时简单拼接SQL方式验证用户名密码则输入特殊语句绕过验证可直接登录系统 | 开发者编码规范意识不足,为图便捷简化代码逻辑,未做输入过滤 | 采用参数化查询用SonarQube等工具做静态代码扫描拦截高危代码 |
| 第三方组件漏洞 | [Cloudflare严重宕机事故导致全球半个互联网瘫痪](https://blog.csdn.net/qq_41603102/article/details/155240625) | 疏于管理第三方依赖,未定期排查组件安全状态 | 用OWASP Dependency - Check定期扫描依赖包及时升级高危漏洞版本组件 |
| 权限管控不严 | 用户看到超过自己权限的数据 | 测试仅关注功能正常场景,未开展越权测试,权限校验逻辑设计简陋 | 实施灰盒测试,覆盖水平越权和垂直越权场景,按最小权限原则分配账户权限 |
| 配置失误泄露 | 误将账号密码等配置文件放Web根目录被搜索引擎抓取 | 运维人员安全意识薄弱,缺乏统一的部署配置规范 | 建立配置基线删除默认账号、禁用不必要的HTTP方法禁用生产环境DEBUG模式 |
| 数据泄露 | 客户测试数据未加密且通过微信、邮箱等传输 | 忽视信息安全问题,未建立数据管理机制 | 对客户数据进行统一管理,使用内网环境传输数据且进行加密 |
### 2. 软件工程全生命周期信息管理各环节常见问题
软件工程全生命周期通常涵盖需求分析、设计、编码、测试、部署运维等环节,各环节信息管理常见问题如下:
1. **需求分析阶段**:需求文档模糊,未明确异常场景和边界条件,比如支付接口未定义重复支付的处理规则,导致用户重复点击多次扣款;同时易出现需求传递偏差,开发团队与业务方沟通不足,致使理解的需求与实际需求不符。
2. **设计阶段**:架构设计不合理,如未考虑高并发场景引发系统卡顿,或未设计数据备份机制存在单点故障风险;接口设计缺乏统一标准,后续各模块对接时出现信息交互混乱,且设计文档未同步更新,导致后续开发无准确参考。
3. **编码阶段**代码规范性差存在空指针异常、数组越界等问题如用SimpleDateFormat引发线程安全问题导致时间解析错误此外依赖管理混乱第三方接口调用未设置超时重试机制且版本冲突易引发类加载异常。
4. **测试阶段**:测试覆盖不全面,未覆盖网络延迟、大流量等极端场景;测试环境与生产环境配置差异大,如数据库字符集不同,导致测试通过的功能上线后出现异常;同时测试用例和测试报告等信息记录不全,故障追溯困难。
5. **部署运维阶段**部署文档缺失或错误导致部署出现异常配置信息混乱如生产环境误用测试环境配置监控告警机制不完善未监控Redis内存使用率等核心指标缓存击穿引发数据库雪崩且日志管理不当DEBUG日志导致磁盘爆满或日志缺失难以排查故障。

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 MiB

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
00 附件/IMG_3042.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.9 MiB

BIN
00 附件/IMG_3366.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.1 MiB

BIN
00 附件/IMG_3688.jpeg Normal file

Binary file not shown.

BIN
00 附件/IMG_4147.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 MiB

BIN
00 附件/IMG_4436.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
00 附件/IMG_4437.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

BIN
00 附件/IMG_4438.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

BIN
00 附件/IMG_4439.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

BIN
00 附件/IMG_4578.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

BIN
00 附件/IMG_4644.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 312 KiB

BIN
00 附件/IMG_4645.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 154 KiB

BIN
00 附件/IMG_4979.jpeg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.8 MiB

Binary file not shown.

Binary file not shown.

165
00 附件/My_strategy.py Normal file
View File

@ -0,0 +1,165 @@
import time
import pandas as pd
import ccxt
from datetime import timedelta
# import pandas_ta
import talib
# ====================================================================================================
# =====格式设置
# ====================================================================================================
pd.set_option('display.max_rows', 1000)
pd.set_option('expand_frame_repr', False) # 当列太多时不换行
# 设置命令行输出时的列对齐功能
pd.set_option('display.unicode.ambiguous_as_wide', True)
pd.set_option('display.unicode.east_asian_width', True)
# ====================================================================================================
# =====创建ccxt交易所
# ====================================================================================================
BINANCE_CONFIG = {
'apiKey': '',
'secret': '',
'proxies': {'http': '127.0.0.1:7890', 'https': '127.0.0.1:7890'}
}
exchange = ccxt.binance(BINANCE_CONFIG)
while True:
# list = ['DOGEUSDT', 'ETHUSDT', 'BTCUSDT']
#
# # for symbol in list:
symbol = 'ETHUSDT'
time_interval = '1m' # 其他可以尝试的值:'1m', '5m', '15m', '30m', '1h', '2h', '1d', '1w', '1M', '1y',并不是每个交易所都支持
bar_num = 1000 # 获取K线的数量
params = {'symbol': symbol, # 交易币对
'interval': time_interval, # 时间间隔
'limit': bar_num} # 数据条数
# ====================================================================================================
# =====获取K线数据
# ====================================================================================================
response = exchange.fapiPublicGetKlines(params=params)
k_lines = pd.DataFrame(response)
# print(k_lines)
# =====整理K线数据
df = pd.DataFrame(response, dtype=float) # 将数据转换为dataframe
df.rename(columns={0: 'MTS', 1: 'Open', 2: 'High',
3: 'Low', 4: 'Close', 5: 'Volume'}, inplace=True) # 重命名
df['candle_begin_time'] = pd.to_datetime(df['MTS'], unit='ms') # 整理时间
df['candle_begin_time_GMT8'] = df['candle_begin_time'] + timedelta(hours=8) # 北京时间
df = df[['candle_begin_time_GMT8', 'Open', 'High', 'Low', 'Close', 'Volume']] # 整理列的顺序
# ====================================================================================================
# =====获取币对的最新价格
# ====================================================================================================
data = exchange.fapiPublicGetTickerPrice(params={'symbol': "ETHUSDT"})
price_ETH = data['price']
# ====================================================================================================
# =====通过pandas-ta计算指标并加入相关指标计算列
# ====================================================================================================
## 计算均线
# df.ta.sma(length=5, append=True, col_names="SMA_5") # pandas-ta 计算SM5指标
df['MA5'] = talib.MA(df['Close'], timeperiod=5) # ta-lib计算MA5指标
# # 计算14日相对强弱指数RSI
# df.ta.rsi(length=14, append=True, col_names="RSI_14") # pandas-ta计算RSI指标
df['RSI_14'] = talib.RSI(df['Close'], timeperiod=14) # ta-lib计算RSI指标
# # 计算MACD12/26/9周期
# df.ta.macd(fast=12, slow=26, signal=9, append=True) # 默认列名MACD_12_26_9, MACDs_12_26_9, MACDh_12_26_9 [2,7](@ref)
# # 计算布林带20日2倍标准差
# df.ta.bbands(length=20, std=2, append=True)
# pandas-ta计算布林带指标
# 默认列名BBL_20_2.0, BBM_20_2.0, BBU_20_2.0
## ta-lib 计算布林带指标
upper_band, middle_band, lower_band = talib.BBANDS(
df['Close'],
timeperiod=20,
nbdevup=2,
nbdevdn=2,
matype=0 # SMA
)
df['BB_Upper'] = upper_band
df['BB_Middle'] = middle_band
df['BB_Lower'] = lower_band
## 计算ADX指标
# df.ta.adx(length=20, append=True) # pandas-ta计算adx
df['ADX_14'] = talib.ADX(df['High'], df['Low'], df['Close'], timeperiod=14) # ta-lib计算ADX指标
## 计算ATR指标
# df.ta.atr(length=16, append=True) # pandas-ta计算atr默认参数14length也可以调整
df['ATR_14'] = talib.ATR(df['High'], df['Low'], df['Close'], timeperiod=14)
print(df)
# df.to_csv('Ta4.csv')
# ====================================================================================================
# =====设置下单条件并执行
# ====================================================================================================
# if float(price_ETH) > float(df['Close'].iloc[-2]):
# print('价格上升')
# else:
# print('价格下降')
#
# print(price_ETH)
# print(df['Close'].iloc[-2])
# print(df['RSI_14'].iloc[-2] > 30)
# 以上为dataframe取数格式的测试目前使用还不太熟练
## 调整杠杆倍率
# params = {'symbol': 'ETHUSDT', # 交易币对
# 'leverage': 10,
# 'timestamp': int(time.time() * 1000)}
# leverage = exchange.fapiPrivatePostLeverage(params=params)
# print('调整开仓杠杆\n', leverage, '\n')
## 下单操作
num = 0
max_num = 3
# 使用变量来控制下单次数
params = {'side': 'BUY',
'symbol': 'ETHUSDT', # 交易币对
'type': 'LIMIT',
# 'price': price_ETH,
'price': df['Close'].iloc[-1],
# 下单价格,在限价单的时候
# 启用将type换成LIMIT
# 此处用变量取代了课程中的数值。以后下单的价格可能需要复杂计算再储存在变量中,做测试。
'quantity': 0.01, # 下单数量
'timestamp': int(time.time() * 1000),
'timeInForce': 'GTC'} # https://academy.binance.com/zh/articles/understanding-the-different-order-types
if df['RSI_14'].iloc[-2] > 30 and df['RSI_14'].iloc[-1] < 30:
print('向下穿越rsi30执行买入')
response = exchange.fapiPrivatePostOrder(params=params)
order_info = pd.DataFrame(response, index=['symbol'])
order_id = order_info['orderId'].iloc[0]
print('下单\n', order_info, '\n')
num += 1
# 此后这里还可以多个条件,组合多个指标的值
# RSI的使用作为一个参考
# 通过现有数据(开高收低量),已经可以计算出不少指标了。
else:
print('不符合交易条件,监控中')
time.sleep(30)
if num >= max_num:
break
## 这是我在办公室电脑上敲的注释
## 测试能否通过iCloud同步成功在家也可已经iCloud对同一个项目进行编辑。

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 222 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 224 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 194 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 174 KiB

View File

@ -0,0 +1,2 @@
SecretId,SecretKey
AKIDiIemiQu9AxWqWyBAvSmriMmyv0ub5NSL,kHclhQzLVSCk5D9rLbeTBh05wa2LQJ2Z
1 SecretId SecretKey
2 AKIDiIemiQu9AxWqWyBAvSmriMmyv0ub5NSL kHclhQzLVSCk5D9rLbeTBh05wa2LQJ2Z

2
00 附件/SecretKey.csv Normal file
View File

@ -0,0 +1,2 @@
SecretId,SecretKey
AKIDiIemiQu9AxWqWyBAvSmriMmyv0ub5NSL,kHclhQzLVSCk5D9rLbeTBh05wa2LQJ2Z
1 SecretId SecretKey
2 AKIDiIemiQu9AxWqWyBAvSmriMmyv0ub5NSL kHclhQzLVSCk5D9rLbeTBh05wa2LQJ2Z

BIN
00 附件/SecretKey.xlsx Normal file

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 MiB

138
00 附件/multi_tf.py Normal file
View File

@ -0,0 +1,138 @@
import freqtrade.vendor.qtpylib.indicators as qtpylib
import numpy as np
import talib.abstract as ta
from freqtrade.strategy import (IStrategy, informative)
from pandas import DataFrame, Series
import talib.abstract as ta
import math
import pandas_ta as pta
# from finta import TA as fta
import logging
from logging import FATAL
logger = logging.getLogger(__name__)
# NOT TO BE USED FOR LIVE!!!!!!
class multi_tf (IStrategy):
def version(self) -> str:
return "v1"
INTERFACE_VERSION = 3
# ROI table:
minimal_roi = {
"0": 0.2
}
# Stoploss:
stoploss = -0.1
# Trailing stop:
trailing_stop = False
trailing_stop_positive = 0.001
trailing_stop_positive_offset = 0.01
trailing_only_offset_is_reached = True
# Sell signal
use_exit_signal = True
exit_profit_only = False
exit_profit_offset = 0.01
ignore_roi_if_entry_signal = False
timeframe = '5m'
process_only_new_candles = True
startup_candle_count = 100
# This method is not required.
# def informative_pairs(self): ...
# Define informative upper timeframe for each pair. Decorators can be stacked on same
# method. Available in populate_indicators as 'rsi_30m' and 'rsi_1h'.
@informative('30m')
@informative('1h')
def populate_indicators_1h(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)
return dataframe
# Define BTC/STAKE informative pair. Available in populate_indicators and other methods as
# 'btc_rsi_1h'. Current stake currency should be specified as {stake} format variable
# instead of hard-coding actual stake currency. Available in populate_indicators and other
# methods as 'btc_usdt_rsi_1h' (when stake currency is USDT).
@informative('1h', 'BTC/{stake}')
def populate_indicators_btc_1h(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)
return dataframe
# Define BTC/ETH informative pair. You must specify quote currency if it is different from
# stake currency. Available in populate_indicators and other methods as 'eth_btc_rsi_1h'.
@informative('1h', 'ETH/BTC')
def populate_indicators_eth_btc_1h(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)
return dataframe
# Define BTC/STAKE informative pair. A custom formatter may be specified for formatting
# column names. A callable `fmt(**kwargs) -> str` may be specified, to implement custom
# formatting. Available in populate_indicators and other methods as 'rsi_fast_upper'.
# Resulting column names: `BTC_rsi_fast_upper_1h`, `BTC_close_1h` ...
@informative('1h', 'BTC/{stake}', 'BTC_{column}_{timeframe}')
def populate_indicators_btc_1h_2(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['rsi_fast_upper'] = ta.RSI(dataframe, timeperiod=4)
return dataframe
# Define BTC/STAKE informative pair. A custom formatter may be specified for formatting
# column names. A callable `fmt(**kwargs) -> str` may be specified, to implement custom
# formatting. Available in populate_indicators and other methods as 'btc_rsi_super_fast_1h'.
@informative('1h', 'BTC/{stake}', '{base}_{column}_{timeframe}')
def populate_indicators_btc_1h_3(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe['rsi_super_fast'] = ta.RSI(dataframe, timeperiod=2)
return dataframe
def populate_indicators(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
# Strategy timeframe indicators for current pair.
dataframe['rsi'] = ta.RSI(dataframe, timeperiod=14)
# Informative pairs are available in this method.
dataframe['rsi_less'] = dataframe['rsi'] < dataframe['rsi_1h']
return dataframe
def populate_entry_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
stake = self.config['stake_currency'].lower()
dataframe.loc[
(
(dataframe[f'btc_{stake}_rsi_1h'] < 35)
&
(dataframe['eth_btc_rsi_1h'] < 50)
&
(dataframe['BTC_rsi_fast_upper_1h'] < 40)
&
(dataframe['btc_rsi_super_fast_1h'] < 30)
&
(dataframe['rsi_30m'] < 40)
&
(dataframe['rsi_1h'] < 40)
&
(dataframe['rsi'] < 30)
&
(dataframe['rsi_less'] == True)
&
(dataframe['volume'] > 0)
),
['enter_long', 'enter_tag']] = (1, 'buy_signal_rsi')
return dataframe
def populate_exit_trend(self, dataframe: DataFrame, metadata: dict) -> DataFrame:
dataframe.loc[
(
(dataframe['rsi'] > 70)
&
(dataframe['rsi_less'] == False)
&
(dataframe['volume'] > 0)
),
['exit_long', 'exit_tag']] = (1, 'exit_signal_rsi')
return dataframe

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 153 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 135 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

File diff suppressed because it is too large Load Diff

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.2 MiB

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.0 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 MiB