期货、期权tick数据接收工具

2023-11-02 19:40

本文主要是介绍期货、期权tick数据接收工具,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!

功能:

1、开启之后,7*24自动运行。

2、在共享内存中存放当个交易日的tick数据,方便随时取用。

3、支持多行情源取数据。经过测试一个行情源峰值带宽要求为20M,所以使用时要配合带宽限制。

4、夜盘结束时输出一下tick数据,白盘结束时输出所有tick。

5、支持查询指令:

 运行时如下:

代码

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

184

185

186

187

188

189

190

191

192

193

194

195

196

197

198

199

200

201

202

203

204

205

206

207

208

209

210

211

212

213

214

215

216

217

218

219

220

221

222

223

224

225

226

227

228

229

230

231

232

233

234

235

236

237

238

239

240

241

242

243

244

245

246

247

248

249

250

251

252

253

254

255

256

257

258

259

260

261

262

263

264

265

266

267

268

269

270

271

272

273

274

275

276

277

278

279

280

281

282

283

284

285

286

287

288

289

290

291

292

293

294

295

296

297

298

299

300

301

302

303

304

305

306

307

308

309

310

311

312

313

314

315

316

317

318

319

320

321

322

323

324

325

326

327

328

329

330

331

332

333

334

335

336

337

338

339

340

341

342

343

344

345

346

347

348

349

350

351

352

353

354

355

356

357

358

359

360

361

362

363

364

365

366

367

368

369

370

371

372

373

374

375

376

377

378

379

380

381

382

383

384

385

386

387

388

389

390

391

392

393

394

395

396

397

398

399

400

401

402

403

404

405

406

407

408

409

410

411

412

413

414

415

416

417

418

419

420

421

422

423

424

425

426

427

428

429

430

431

432

433

434

435

436

437

438

439

440

441

442

443

444

445

446

447

448

449

450

451

452

453

454

455

456

457

458

459

460

461

462

463

464

465

466

467

468

469

470

471

472

473

474

475

476

477

478

479

480

481

482

483

484

485

486

487

488

489

490

491

492

493

494

495

496

497

498

499

500

501

502

503

504

505

506

507

508

509

510

511

512

513

514

// FutureDataReceive.cpp : 定义控制台应用程序的入口点。

//

#include "stdafx.h"

#include "ThostFtdcMdSpiImpl.hpp"

#include "ThostFtdcTraderSpiImpl.hpp"

#include "future_helper.h"

#include "TinyConfig.h"

#include "FileMap.h"

#include <boost/lockfree/queue.hpp>

#include <iostream>

#include <conio.h>

CFileMap g_fileMap;

TinyConfig g_config;

CThostFtdcTraderSpiImpl g_trade;

vector<shared_ptr<CThostFtdcMdSpiImpl>> g_vecQuote;

int g_nPreTradingDay;

int g_nTradingDay;

bool g_bThread = true;

boost::lockfree::queue<CThostFtdcDepthMarketDataField> g_buffer(1000);

shared_ptr<thread> g_thdDealData = nullptr;

vector<CThostFtdcDepthMarketDataField> g_vecBuffer;

void OnLog(const char* p)

{

    printf(p);

    ofstream ofs_log("./log.data.receive.txt", ios_base::app);

    ofs_log << future_helper::get_local_datetime().c_str() << " " << p;

    ofs_log.close();

}

#pragma region trade module

///trade call back

bool g_bTradeLoginIn = false;

void OnTradeComplete()

{

    int nTradingDay = atoi(g_trade.GetTradingDay());

    if (g_nTradingDay != 0 && g_nTradingDay != nTradingDay)

        g_nPreTradingDay = g_nTradingDay;

    g_nTradingDay = nTradingDay;

    g_bTradeLoginIn = true;

    printf("交易日:%d-%d\n", g_nPreTradingDay, g_nTradingDay);

}

void OnTradeRspMessage(const char* from, const char* msg, future_msg_type msg_type)

{

    OnLog(future_helper::format_string("%s%s:%s\n", msg_type == future_msg_type::CTP_SUCCESS ? "" "*", from, msg).c_str());

}

void TradeLogin()

{

    int retry_time = 3;

    while (1)

    {

        g_bTradeLoginIn = false;

        g_trade.SetCallBackFunc(OnTradeComplete, nullptr, OnTradeRspMessage);

        g_trade.SetAuthenticate(g_config.GetValue("Trade""product").c_str(), g_config.GetValue("Trade""id").c_str(), g_config.GetValue("Trade""code").c_str());

        g_trade.InitParams(g_config.GetValue("Trade""ip").c_str(), g_config.GetValue("Trade""broker").c_str(),

            g_config.GetValue("Trade""user").c_str(), g_config.GetValue("Trade""password").c_str());

        int tick = GetTickCount();

        while (1)

        {

            if (g_bTradeLoginIn) break;

            this_thread::sleep_for(chrono::milliseconds(100));

            if (GetTickCount() - tick > 60 * 1000) break;

        }

        g_trade.Release();

        g_fileMap.SetTradingDay(g_nPreTradingDay, g_nTradingDay);

        if (g_bTradeLoginIn) break;

        retry_time--;

        OnLog("交易 登录超时[1分钟],重新登录\n");

        if (retry_time == 0)

        {

            OnLog("交易 登录次数达到3次,不再尝试重新登录!\n");

            break;

        }

    }

}

//

#pragma endregion trade module

///market call back

int g_nMarketLoginIn = 0;

void OnMarketComplete()

{

    g_nMarketLoginIn++;

}

void OnMarketRspMessage(const char* from, const char* msg, future_msg_type msg_type)

{

    OnLog(future_helper::format_string("%s%s:%s\n", msg_type == future_msg_type::CTP_SUCCESS ? "" "*", from, msg).c_str());

}

void OnDepthMarketData(CThostFtdcDepthMarketDataField* p)

{

    if (!p) return;

    g_buffer.push(*p);

}

void MarketLogin()

{

    int retry_time = 3;

    std::vector<CThostFtdcInstrumentField> vecTradingCode;

    g_trade.GetTradingCode(vecTradingCode, THOST_FTDC_PC_Futures);

    g_trade.GetTradingCode(vecTradingCode, THOST_FTDC_PC_Options);

    printf("订阅合约:%d\n", vecTradingCode.size());

    g_fileMap.SetTradingCode(vecTradingCode);

    while (1)

    {

        g_nMarketLoginIn = 0;

        for (int i = 1; i <= 3; i++)

        {

            string this_ip = g_config.GetValue("Market", future_helper::format_string("ip%d", i).c_str());

            if (this_ip == ""break;

            auto pMdSpi = make_shared<CThostFtdcMdSpiImpl>();

            g_vecQuote.push_back(pMdSpi);

            pMdSpi->SetTradingCode(vecTradingCode);

            pMdSpi->SetCallBackFunc(OnDepthMarketData, OnMarketRspMessage, nullptr, OnMarketComplete);

            pMdSpi->InitParams(this_ip.c_str(), "8888""88888888""88888888");

        }

        int tick = GetTickCount();

        while (1)

        {

            if (g_nMarketLoginIn == g_vecQuote.size()) break;

            this_thread::sleep_for(chrono::milliseconds(100));

            if (GetTickCount() - tick > 60 * 1000) break;

        }

        if (g_nMarketLoginIn > 0 && g_nMarketLoginIn != g_vecQuote.size())

        {

            int nUnconnectIndex = 1;

            OnLog("***********************\n");

            OnLog("*有未能正常登录的行情账号:\n");

            for (auto iter = g_vecQuote.begin(); iter != g_vecQuote.end(); iter++)

            {

                if (!(*iter)->IsConnected())

                {

                    OnLog(future_helper::format_string("%d、%s\n", nUnconnectIndex, (*iter)->GetFrontIP()).c_str());

                    nUnconnectIndex++;

                }

            }

            OnLog("***********************\n");

            OnLog("已有行情连接成功,未连接的不尝试重连\n");

        }

        if (g_nMarketLoginIn > 0) break;

        OnLog("行情 登录超时[1分钟],重新登录\n");

        retry_time--;

        if (retry_time == 0)

        {

            OnLog("行情 登录次数达到3次,不再尝试重新登录!\n");

            break;

        }

    }

}

void ThreadConsumeTick()

{

    OnLog("处理线程已启动\n");

    map<string, CThostFtdcDepthMarketDataField> m_mapShot;

    while (g_bThread)

    {

        if (g_buffer.empty())

        {

            this_thread::sleep_for(chrono::milliseconds(5));

            continue;

        }

        CThostFtdcDepthMarketDataField data;

        g_buffer.pop(data);

        if (data.UpdateTime[2] == ':') {

            data.UpdateTime[2] = data.UpdateTime[3];

            data.UpdateTime[3] = data.UpdateTime[4];

            data.UpdateTime[4] = data.UpdateTime[6];

            data.UpdateTime[5] = data.UpdateTime[7];

            data.UpdateTime[6] = 0;

        }

         

        if (atoi(data.UpdateTime) > 180000) {

            _snprintf_s(data.TradingDay, 9, "%d", g_nPreTradingDay);

        }

        else {

            _snprintf_s(data.TradingDay, 9, "%d", g_nTradingDay);

        }

        bool bNewTick = false;

        auto find_shot = m_mapShot.find(data.InstrumentID);

        if (find_shot == m_mapShot.end())

        {

            bNewTick = true;

            m_mapShot[data.InstrumentID] = data;

        }

        else

        {

            long long llThis = future_helper::to_longlong(atoi(data.TradingDay), atoi(data.UpdateTime)) * 1000 + data.UpdateMillisec;

            long long llLast = future_helper::to_longlong(atoi(find_shot->second.TradingDay), atoi(find_shot->second.UpdateTime)) * 1000 + find_shot->second.UpdateMillisec;

            if (llThis > llLast || find_shot->second.Volume < data.Volume)

            {//郑商所没有毫秒

                bNewTick = true;

                find_shot->second = data;

            }

        }

        if (bNewTick && g_fileMap.IsOK()) {

            g_fileMap.AddDepthData(&data);

        }

        else if (bNewTick) {

            g_vecBuffer.push_back(data);

        }

    }

    OnLog("处理线程已退出\n");

}

//bReset == true:清空共享内存中的tick数据

void OutPutTickData(bool bReset)

{

    unsigned int* exist_size;

    CThostFtdcDepthMarketDataField* p = g_fileMap.GetDepthData(&exist_size);

    if (!p || *exist_size <= 0) {

        OnLog("共享内存中无任何tick数据\n从内存中导出\n");

        if (g_vecBuffer.size() == 0)

        {

            OnLog("内存中无任何tick数据\n");

            return;

        }

        future_helper::safe_create_floder((g_config.GetValue("Path""tick_normal") + "\\" + future_helper::to_string(g_nTradingDay / 10000)).c_str());

        ofstream ofs_tick(g_config.GetValue("Path""tick_normal") + "\\" + future_helper::to_string(g_nTradingDay / 10000) +

            "\\data_" + future_helper::to_string(g_nTradingDay) + ".txt", ios_base::out);

        for (auto& field : g_vecBuffer)

        {

            char szBuf[1024];

            _snprintf_s(szBuf, 1024,

                //交易日,最后修改时间,最后修改毫秒,合约代码,

                //最新价,上次结算价,昨收盘,昨持仓量,

                //今开盘,最高价,最低价,数量,成交金额,持仓量,

                //涨停板价,跌停板价,

                //申买价一,申买量一,申卖价一,申卖量一,

                //当日均价

                "%s,%s,%d,%s,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f,%d,%.4f,%.4f,%.4f,%.4f,%.4f,%d,%.4f,%d,%.4f\n",

                field.TradingDay, field.UpdateTime, field.UpdateMillisec, field.InstrumentID,

                field.LastPrice, field.PreSettlementPrice, field.PreClosePrice, field.PreOpenInterest,

                field.OpenPrice, field.HighestPrice, field.LowestPrice, field.Volume, field.Turnover, field.OpenInterest,

                field.UpperLimitPrice, field.LowerLimitPrice,

                field.BidPrice1, field.BidVolume1, field.AskPrice1, field.AskVolume1,

                field.AveragePrice);

            ofs_tick << szBuf;

        }

        return;

    }

    OnLog(future_helper::format_string("输出共享内存中的tick数据 %d 个\n", *exist_size).c_str());

    future_helper::safe_create_floder((g_config.GetValue("Path""tick_normal") + "\\" + future_helper::to_string(g_nTradingDay / 10000)).c_str());

    ofstream ofs_tick(g_config.GetValue("Path""tick_normal") + "\\" + future_helper::to_string(g_nTradingDay / 10000) +

        "\\data_" + future_helper::to_string(g_nTradingDay) + ".txt", ios_base::out);

    for (int i = 0; i < *exist_size; i++)

    {

        auto& field = *(CThostFtdcDepthMarketDataField*)(p + i);

        char szBuf[1024];

        _snprintf_s(szBuf, 1024,

            //交易日,最后修改时间,最后修改毫秒,合约代码,

            //最新价,上次结算价,昨收盘,昨持仓量,

            //今开盘,最高价,最低价,数量,成交金额,持仓量,

            //涨停板价,跌停板价,

            //申买价一,申买量一,申卖价一,申卖量一,

            //当日均价

            "%s,%s,%d,%s,%.3f,%.4f,%.4f,%.4f,%.4f,%.4f,%.4f,%d,%.4f,%.4f,%.4f,%.4f,%.4f,%d,%.4f,%d,%.4f",

            field.TradingDay, field.UpdateTime, field.UpdateMillisec, field.InstrumentID,

            future_helper::check_double(field.LastPrice), future_helper::check_double(field.PreSettlementPrice), future_helper::check_double(field.PreClosePrice), future_helper::check_double(field.PreOpenInterest),

            future_helper::check_double(field.OpenPrice), future_helper::check_double(field.HighestPrice), future_helper::check_double(field.LowestPrice), field.Volume, future_helper::check_double(field.Turnover), future_helper::check_double(field.OpenInterest),

            future_helper::check_double(field.UpperLimitPrice), future_helper::check_double(field.LowerLimitPrice),

            future_helper::check_double(field.BidPrice1), field.BidVolume1, future_helper::check_double(field.AskPrice1), field.AskVolume1,

            future_helper::check_double(field.AveragePrice));

        ofs_tick << szBuf << endl;

    }

    ofs_tick.flush();

    ofs_tick.close();

    if (bReset)

        *exist_size = 0;

}

void Open()

{

    printf("%s\n", future_helper::get_local_datetime().c_str());

    g_nMarketLoginIn = 0;

    OnLog("区间交易开始!\n");

    if (!g_thdDealData) {

        g_bThread = true;

        g_thdDealData = make_shared<thread>(ThreadConsumeTick);

    }

    if (!g_fileMap.CreateFileMap(FILE_MAP_KEY))

    {

        OnLog("共享内存创建失败!直接存文件...\n");

    }

    else

    {

        g_fileMap.InitDefaultRange();

    }

    TradeLogin();

    unsigned int* exist_count;

    auto pTick = g_fileMap.GetDepthData(&exist_count);

    int local_time = atoi(future_helper::get_local_time(false).c_str());

    if ((!pTick || *exist_count == 0) && (local_time < 151500 || local_time > 180000))

    {

        ifstream ifs_tick(g_config.GetValue("Path""tick_normal") + "\\" + future_helper::to_string(g_nTradingDay / 10000) +

            "\\data_" + future_helper::to_string(g_nTradingDay) + ".txt", ios_base::in);

        if (ifs_tick.is_open())

        {

            OnLog("本地加载tick到共享内存:");

            int tick_count = 0;

            CThostFtdcDepthMarketDataField data;

            char szLine[1024];

            while (ifs_tick.getline(szLine, 1024))

            {

                future_helper::LineToStruct(szLine, data);

                g_fileMap.AddDepthData(&data);

                tick_count++;

            }

            OnLog(future_helper::format_string("%d条\n", tick_count).c_str());

        }

    }

    MarketLogin();

}

void Close()

{

    printf("%s\n", future_helper::get_local_datetime().c_str());

    int close_count = 0;

    for (auto& md : g_vecQuote)

    {

        if (md->IsConnected()) {

            close_count++;

            md->ReleaseAPI();

        }

    }

    g_vecQuote.clear();

    if (close_count > 0) {

        OnLog(future_helper::format_string("区间交易结束!关闭行情接收:%d\n", close_count).c_str());

        if (g_thdDealData && g_thdDealData->joinable()) {

            g_bThread = false;

            g_thdDealData->join();

            g_thdDealData = nullptr;

        }

    }

    g_nMarketLoginIn = 0;

    OnLog(future_helper::format_string("共享内存使用%d/%d(mb)=%.2f%%%%\n",

        g_fileMap.GetTotalUsedSpace() / 1024 / 1024, MAX_PAGE_SIZE / 1024 / 1024,

        (double)g_fileMap.GetTotalUsedSpace() * 100 / MAX_PAGE_SIZE).c_str());

}

int main()

{

    if (!g_config.Open((future_helper::GetWorkingDir() + "\\system.ini").c_str()))

    {

        OnLog("system.ini打开失败\n");

        system("pause");

    }

    OnLog("执行开启共享内存测试...");

    if (!g_fileMap.CreateFileMap(FILE_MAP_KEY))

    {

        OnLog("失败!");

        system("pause");

    }

    else

    {

        OnLog("成功!\n");

        g_fileMap.Release();

    }

    OnLog("==========start==========\n");

    printf("初次启动需要输入前交易日,用来更新夜盘的日期...");

    scanf_s("%d", &g_nPreTradingDay);

    int night_tick_count = -1;

    int last_local_time = atoi(future_helper::get_local_time(false).c_str());

    while (1)

    {

        if (_kbhit() != 0)

        {

            printf("**********不要长时间阻塞此处,这样将导致软件无法正常工作!***********\n");

            printf("**********记得输入完之后按回车键哦!                      ***********\n");

            string str;

            std::getline(std::cin, str);

            if (str == "quit")

            {

                Close();

                break;

            }

            else if (str == "help")

            {

                printf("quit:退出\n");

                printf("help:帮助\n");

                printf("open:手动开启接收\n");

                printf("close:手动关闭接收\n");

                printf("tradingday:交易日\n");

                printf("tradingcode:可交易合约\n");

                printf("tickdata:输出接收到的tick数据\n");

                printf("sharememory:共享内存使用率\n");

            }

            else if (str == "open")

            {

                Open();

            }

            else if (str == "close")

            {

                Close();

            }

            else if (str == "tradingday")

            {

                printf("交易日:%d-%d\n", g_nPreTradingDay, g_nTradingDay);

            }

            else if (str == "tradingcode")

            {

                printf("期货可交易合约:\n");

                map<string, vector<CThostFtdcInstrumentField>> mapClasses;

                vector<CThostFtdcInstrumentField> vec;

                g_trade.GetTradingCode(vec, THOST_FTDC_PC_Futures);

                for (auto& item : vec)

                {

                    mapClasses[item.ProductID].push_back(item);

                }

                for (auto iter = mapClasses.begin(); iter != mapClasses.end(); iter++)

                {

                    printf("%s:", iter->first.c_str());

                    for (auto& item : iter->second)

                    {

                        printf("%s ", item.InstrumentID);

                    }

                    printf("\n");

                }

            }

            else if (str == "tickdata")

            {

                OutPutTickData(false);

            }

            else if (str == "sharememory")

            {

                unsigned int* exist_size;

                CThostFtdcDepthMarketDataField* p = g_fileMap.GetDepthData(&exist_size);

                OnLog(future_helper::format_string("tick数据个数:%d\n共享内存使用%d/%d(mb)=%.2f%%%%\n",

                    p ? *exist_size : 0,

                    g_fileMap.GetTotalUsedSpace() / 1024 / 1024, MAX_PAGE_SIZE / 1024 / 1024,

                    (double)g_fileMap.GetTotalUsedSpace() * 100 / MAX_PAGE_SIZE).c_str());

            }

        }

        int local_time = atoi(future_helper::get_local_time(false).c_str());

        if ((local_time >= 23500 && last_local_time < 23500) ||

            (local_time >= 155000 && last_local_time < 155000))

        {

            unsigned int* exist_count;

            auto pTick = g_fileMap.GetDepthData(&exist_count);

            Close();

            if ((local_time >= 155000 && last_local_time < 155000)){

                OnLog("交易日结束了?...");

                if (night_tick_count == -1 || *exist_count > night_tick_count) {

                    OnLog("是的!\n");

                    OutPutTickData(true);

                    if (night_tick_count != -1) {

                        OnLog("打开TickToKline.exe\n");

                        ::ShellExecute(NULL, "open", (future_helper::GetWorkingDir() + "\\TickToKline.exe").c_str(), "1", NULL, SW_SHOW);

                    }

                     

                    night_tick_count = -1;

                }

                else

                {

                    OnLog(future_helper::format_string("没有!(共享内存的数据没有比夜盘多%d-%d)!\n",

                        night_tick_count, *exist_count).c_str());

                }

            }

            else

            {

                OnLog("夜盘结束了?...");

                if (night_tick_count == -1 && *exist_count > 0) {

                    OnLog("是的!输出一次夜盘数据\n");

                    night_tick_count = *exist_count;

                    OutPutTickData(false);

                }

                else

                {

                    OnLog("现在不是夜盘结束时间!(没有夜盘数据 或者 已经输出过一次夜盘数据了)\n");

                }

            }

        }

        if ((local_time >= 82000 && last_local_time < 82000) ||

            (local_time >= 202000 && last_local_time < 202000))

        {

            Close();

            Open();

        }

        last_local_time = local_time;

        this_thread::sleep_for(chrono::seconds(1));

    }

    return 0;

}

这篇关于期货、期权tick数据接收工具的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/332851

相关文章

基于Python实现一个图片拆分工具

《基于Python实现一个图片拆分工具》这篇文章主要为大家详细介绍了如何基于Python实现一个图片拆分工具,可以根据需要的行数和列数进行拆分,感兴趣的小伙伴可以跟随小编一起学习一下... 简单介绍先自己选择输入的图片,默认是输出到项目文件夹中,可以自己选择其他的文件夹,选择需要拆分的行数和列数,可以通过

Python使用vllm处理多模态数据的预处理技巧

《Python使用vllm处理多模态数据的预处理技巧》本文深入探讨了在Python环境下使用vLLM处理多模态数据的预处理技巧,我们将从基础概念出发,详细讲解文本、图像、音频等多模态数据的预处理方法,... 目录1. 背景介绍1.1 目的和范围1.2 预期读者1.3 文档结构概述1.4 术语表1.4.1 核

Python使用pip工具实现包自动更新的多种方法

《Python使用pip工具实现包自动更新的多种方法》本文深入探讨了使用Python的pip工具实现包自动更新的各种方法和技术,我们将从基础概念开始,逐步介绍手动更新方法、自动化脚本编写、结合CI/C... 目录1. 背景介绍1.1 目的和范围1.2 预期读者1.3 文档结构概述1.4 术语表1.4.1 核

Python使用OpenCV实现获取视频时长的小工具

《Python使用OpenCV实现获取视频时长的小工具》在处理视频数据时,获取视频的时长是一项常见且基础的需求,本文将详细介绍如何使用Python和OpenCV获取视频时长,并对每一行代码进行深入解析... 目录一、代码实现二、代码解析1. 导入 OpenCV 库2. 定义获取视频时长的函数3. 打开视频文

MySQL 删除数据详解(最新整理)

《MySQL删除数据详解(最新整理)》:本文主要介绍MySQL删除数据的相关知识,本文通过实例代码给大家介绍的非常详细,对大家的学习或工作具有一定的参考借鉴价值,需要的朋友参考下吧... 目录一、前言二、mysql 中的三种删除方式1.DELETE语句✅ 基本语法: 示例:2.TRUNCATE语句✅ 基本语

Linux中压缩、网络传输与系统监控工具的使用完整指南

《Linux中压缩、网络传输与系统监控工具的使用完整指南》在Linux系统管理中,压缩与传输工具是数据备份和远程协作的桥梁,而系统监控工具则是保障服务器稳定运行的眼睛,下面小编就来和大家详细介绍一下它... 目录引言一、压缩与解压:数据存储与传输的优化核心1. zip/unzip:通用压缩格式的便捷操作2.

MyBatisPlus如何优化千万级数据的CRUD

《MyBatisPlus如何优化千万级数据的CRUD》最近负责的一个项目,数据库表量级破千万,每次执行CRUD都像走钢丝,稍有不慎就引起数据库报警,本文就结合这个项目的实战经验,聊聊MyBatisPl... 目录背景一、MyBATis Plus 简介二、千万级数据的挑战三、优化 CRUD 的关键策略1. 查

python实现对数据公钥加密与私钥解密

《python实现对数据公钥加密与私钥解密》这篇文章主要为大家详细介绍了如何使用python实现对数据公钥加密与私钥解密,文中的示例代码讲解详细,感兴趣的小伙伴可以跟随小编一起学习一下... 目录公钥私钥的生成使用公钥加密使用私钥解密公钥私钥的生成这一部分,使用python生成公钥与私钥,然后保存在两个文

mysql中的数据目录用法及说明

《mysql中的数据目录用法及说明》:本文主要介绍mysql中的数据目录用法及说明,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录1、背景2、版本3、数据目录4、总结1、背景安装mysql之后,在安装目录下会有一个data目录,我们创建的数据库、创建的表、插入的

sqlite3 命令行工具使用指南

《sqlite3命令行工具使用指南》本文系统介绍sqlite3CLI的启动、数据库操作、元数据查询、数据导入导出及输出格式化命令,涵盖文件管理、备份恢复、性能统计等实用功能,并说明命令分类、SQL语... 目录一、启动与退出二、数据库与文件操作三、元数据查询四、数据操作与导入导出五、查询输出格式化六、实用功