{
    "id": 7669000205218481,
    "name": "CapitalFlowTutorial",
    "owner": "admin",
    "data": {
        "datasources": [
            {
                "id": "6477480774847236",
                "name": "主力资金流向",
                "type": 6,
                "mode": "sql",
                "max_line": null,
                "data": [],
                "cols": [],
                "type_map": {
                    "时间": 8,
                    "股价": 16,
                    "主力净流入": 16
                },
                "deps": [
                    "2975914400103178"
                ],
                "variables": [],
                "error_message": "",
                "ddb": null,
                "auto_refresh": true,
                "code": "\r\nres = select time(TradeTime) as 时间, \r\n            TradePrice as 股价, \r\n            ((BuyBigAmount)-(SellBigAmount))/10000 as 主力净流入\r\n    from tutorial.orca_table.capitalFlowStream\r\n    where SecurityID=string({{id}})\r\nif(res.rows()==0){\r\n    insert into res values(time(now()), 0,0)\r\n}\r\nres = select * from res where isDuplicated(时间, LAST)=false\r\nres",
                "interval": 1,
                "timer": null,
                "filter": false,
                "stream_table": "",
                "filter_column": "",
                "filter_expression": "",
                "ip": ""
            },
            {
                "id": "5107860910725940",
                "name": "今日资金净流向",
                "type": 6,
                "mode": "sql",
                "max_line": null,
                "data": [],
                "cols": [],
                "type_map": {
                    "净大单": 16,
                    "净中单": 16,
                    "净小单": 16
                },
                "deps": [
                    "629432003138060"
                ],
                "variables": [],
                "error_message": "",
                "ddb": null,
                "auto_refresh": true,
                "code": "r = select last(BuyBigAmount) as BuyBigAmount,\r\n           last(SellBigAmount) as SellBigAmount,\r\n           last(BuyMediumAmount) as BuyMediumAmount,\r\n           last(SellMediumAmount) as SellMediumAmount,\r\n           last(BuySmallAmount) as BuySmallAmount,\r\n           last(SellSmallAmount) as SellSmallAmount\r\n    from tutorial.orca_table.capitalFlowStream\r\n    group by SecurityID\r\nres = select (BuyBigAmount-SellBigAmount) / 10000 as 净大单, \r\n             (BuyMediumAmount-SellMediumAmount) / 10000 as 净中单, \r\n             (BuySmallAmount-SellSmallAmount) / 10000 as 净小单\r\n        from r\r\n        where SecurityID=string({{id}})\r\n// res = table(res.colNames() as name, res.values().flatten() as val)\r\nres",
                "interval": 1,
                "timer": null,
                "filter": false,
                "stream_table": "",
                "filter_column": "",
                "filter_expression": "",
                "ip": ""
            },
            {
                "id": "2560368696705158",
                "name": "今日资金流向明细",
                "type": 6,
                "mode": "sql",
                "max_line": null,
                "data": [],
                "cols": [],
                "type_map": {
                    "分类": 18,
                    "流入": 4,
                    "流出": 4
                },
                "deps": [
                    "4802372013372962"
                ],
                "variables": [],
                "error_message": "",
                "ddb": null,
                "auto_refresh": true,
                "code": "r = select last(BuyBigAmount) as BuyBigAmount,\r\n           last(SellBigAmount) as SellBigAmount,\r\n           last(BuyMediumAmount) as BuyMediumAmount,\r\n           last(SellMediumAmount) as SellMediumAmount,\r\n           last(BuySmallAmount) as BuySmallAmount,\r\n           last(SellSmallAmount) as SellSmallAmount\r\n    from tutorial.orca_table.capitalFlowStream\r\n    group by SecurityID\r\n// 流入\r\nbuyInfo = select BuyBigAmount, BuyMediumAmount, BuySmallAmount \r\n        from r\r\n        where SecurityID=string({{id}})\r\n// 流出\r\nsellInfo = select SellBigAmount, SellMediumAmount, SellSmallAmount \r\n        from r\r\n        where SecurityID=string({{id}})\r\n// 结果表汇总\r\nif(buyInfo.rows()>0){\r\n\tbuyValue = buyInfo.values().flatten() / 10000\r\n}else{\r\n\tbuyValue = [0,0,0]\r\n}\r\nif(sellInfo.rows()>0){\r\n\tsellValue = sellInfo.values().flatten() / 10000\r\n}else{\r\n\tsellValue = [0,0,0]\r\n}\r\nres = table(`大单`中单`小单 as 分类, \r\n\t\t\tbuyValue as 流入, \r\n\t\t\tsellValue as 流出)\r\nres",
                "interval": 1,
                "timer": null,
                "filter": false,
                "stream_table": "",
                "filter_column": "",
                "filter_expression": "",
                "ip": ""
            },
            {
                "id": "4300685768597420",
                "name": "今日资金流向汇总",
                "type": 6,
                "mode": "sql",
                "max_line": null,
                "data": [],
                "cols": [],
                "type_map": {
                    "主力流入": 16,
                    "主力流出": 16,
                    "净主力流入": 16
                },
                "deps": [
                    "3116811905440760"
                ],
                "variables": [],
                "error_message": "",
                "ddb": null,
                "auto_refresh": true,
                "code": "r = select last(BuyBigAmount) as BuyBigAmount,\r\n           last(SellBigAmount) as SellBigAmount,\r\n           last((BuyBigAmount)-(SellBigAmount)) as BS \r\n    from tutorial.orca_table.capitalFlowStream\r\n    group by SecurityID\r\nres = select (BuyBigAmount)/10000 as 主力流入, \r\n            (SellBigAmount)/10000 as 主力流出, \r\n            (BS)/10000 as 净主力流入\r\n    from r\r\n    where SecurityID=string({{id}})\r\nif(res.rows()==0){\r\n    insert into res values(0,0,0)\r\n}\r\nres",
                "interval": 1,
                "timer": null,
                "filter": false,
                "stream_table": "",
                "filter_column": "",
                "filter_expression": "",
                "ip": ""
            }
        ],
        "variables": [
            {
                "id": "5418329751889900",
                "name": "id",
                "display_name": "股票代码",
                "mode": "select",
                "code": "select SecurityID as f1, \"'\" + SecurityID + \"'\" as f2\r\nfrom (\r\n    select sum(TradePrice * TradeQty) as num, SecurityID\r\n    from loadTable(\"dfs://trade\", \"trade\")\r\n    where TradeDate = 2024.10.09\r\n    group by SecurityID\r\n)\r\nwhere num > 0\r\norder by SecurityID\r\n",
                "deps": [],
                "value": "",
                "options": [
                    {
                        "key": "1865642038882006",
                        "label": "000000",
                        "value": "'000000'"
                    },
                    {
                        "key": "2490388090538419",
                        "label": "999999",
                        "value": "'999999'"
                    }
                ]
            }
        ],
        "canvas": {
            "widgets": [
                {
                    "id": "3116811905440760",
                    "w": 5,
                    "h": 4,
                    "x": 0,
                    "y": 0,
                    "type": "TABLE",
                    "source_id": [
                        "4300685768597420"
                    ],
                    "config": {
                        "title": "今日资金流向（万元）",
                        "title_size": 18,
                        "padding": {
                            "top": 12,
                            "bottom": 12,
                            "left": 12,
                            "right": 12
                        },
                        "bordered": false,
                        "need_select_cols": false,
                        "is_reverse": false,
                        "variable_ids": [
                            "5418329751889900"
                        ],
                        "variable_cols": 3,
                        "variable_form_label_col": 40,
                        "with_search_btn": false,
                        "search_btn_label": "查询",
                        "col_properties": [
                            {
                                "col": "主力流入",
                                "show": true,
                                "with_value_format": false,
                                "font_size": 14,
                                "is_thousandth_place": false,
                                "align": "left",
                                "sorter": false,
                                "decimal_places": 0,
                                "width": 140,
                                "color": "#f70303"
                            },
                            {
                                "col": "主力流出",
                                "show": true,
                                "with_value_format": false,
                                "font_size": 14,
                                "is_thousandth_place": false,
                                "align": "left",
                                "sorter": false,
                                "width": 140,
                                "decimal_places": 0,
                                "color": "#00ff1a"
                            },
                            {
                                "col": "净主力流入",
                                "show": true,
                                "with_value_format": false,
                                "font_size": 14,
                                "is_thousandth_place": false,
                                "align": "left",
                                "sorter": false,
                                "width": 140,
                                "decimal_places": 0,
                                "display_name": "主力净流入",
                                "threshold": 0
                            }
                        ],
                        "pagination": {
                            "show": true
                        }
                    }
                },
                {
                    "id": "4802372013372962",
                    "w": 5,
                    "h": 4,
                    "x": 5,
                    "y": 0,
                    "type": "TABLE",
                    "source_id": [
                        "2560368696705158"
                    ],
                    "config": {
                        "title": "",
                        "title_size": 18,
                        "padding": {
                            "top": 12,
                            "bottom": 12,
                            "left": 12,
                            "right": 12
                        },
                        "bordered": false,
                        "need_select_cols": false,
                        "is_reverse": false,
                        "variable_ids": [],
                        "variable_cols": 3,
                        "variable_form_label_col": 40,
                        "with_search_btn": false,
                        "search_btn_label": "查询",
                        "col_properties": [
                            {
                                "col": "分类",
                                "show": true,
                                "with_value_format": false,
                                "font_size": 14,
                                "is_thousandth_place": false,
                                "align": "left",
                                "sorter": false,
                                "width": 140
                            },
                            {
                                "col": "流入",
                                "show": true,
                                "with_value_format": false,
                                "font_size": 14,
                                "is_thousandth_place": false,
                                "align": "left",
                                "sorter": false,
                                "width": 140,
                                "decimal_places": 0,
                                "color": "#fc0404"
                            },
                            {
                                "col": "流出",
                                "show": true,
                                "with_value_format": false,
                                "font_size": 14,
                                "is_thousandth_place": false,
                                "align": "left",
                                "sorter": false,
                                "width": 140,
                                "decimal_places": 0,
                                "color": "#00ff2a"
                            }
                        ],
                        "pagination": {
                            "show": true
                        }
                    }
                },
                {
                    "id": "629432003138060",
                    "w": 5,
                    "h": 5,
                    "x": 0,
                    "y": 4,
                    "type": "BAR",
                    "source_id": [
                        "5107860910725940"
                    ],
                    "config": {
                        "title": "",
                        "title_size": 18,
                        "padding": {
                            "top": 12,
                            "bottom": 12,
                            "left": 12,
                            "right": 12
                        },
                        "animation": true,
                        "variable_cols": 3,
                        "with_search_btn": false,
                        "search_btn_label": "查询",
                        "legend": {
                            "show": true,
                            "top": null,
                            "bottom": null,
                            "left": "center",
                            "right": null,
                            "textStyle": {
                                "color": "#fff"
                            },
                            "itemHeight": 14
                        },
                        "tooltip": {
                            "show": true
                        },
                        "splitLine": {
                            "show": false,
                            "lineStyle": {
                                "color": "#6E6F7A",
                                "width": 1,
                                "type": "dashed"
                            }
                        },
                        "x_datazoom": false,
                        "y_datazoom": false,
                        "xAxis": {
                            "type": "category",
                            "name": "种类",
                            "fontsize": 12,
                            "font_color": "#312a2a",
                            "col_name": "净大单"
                        },
                        "yAxis": [
                            {
                                "type": "value",
                                "name": "名称",
                                "col_name": "净超大",
                                "position": "left",
                                "offset": 0,
                                "fontsize": 12,
                                "with_zero": true
                            }
                        ],
                        "series": [
                            {
                                "col_name": "净大单",
                                "name": "净大单",
                                "type": "BAR",
                                "color": null,
                                "yAxisIndex": 0
                            },
                            {
                                "col_name": "净中单",
                                "name": "净中单",
                                "type": "BAR",
                                "color": null,
                                "yAxisIndex": 0
                            },
                            {
                                "col_name": "净小单",
                                "name": "净小单",
                                "type": "BAR",
                                "color": null,
                                "yAxisIndex": 0
                            }
                        ]
                    }
                },
                {
                    "id": "2975914400103178",
                    "w": 5,
                    "h": 6,
                    "x": 5,
                    "y": 4,
                    "type": "MIX",
                    "source_id": [
                        "6477480774847236"
                    ],
                    "config": {
                        "title": "主力资金趋势（万元）",
                        "title_size": 18,
                        "padding": {
                            "top": 12,
                            "bottom": 12,
                            "left": 12,
                            "right": 12
                        },
                        "animation": true,
                        "variable_cols": 3,
                        "with_search_btn": false,
                        "search_btn_label": "查询",
                        "legend": {
                            "show": true,
                            "top": null,
                            "bottom": null,
                            "left": "center",
                            "right": null,
                            "textStyle": {
                                "color": "#fff"
                            },
                            "itemHeight": 14
                        },
                        "tooltip": {
                            "show": true
                        },
                        "splitLine": {
                            "show": false,
                            "lineStyle": {
                                "color": "#6E6F7A",
                                "width": 1,
                                "type": "dashed"
                            }
                        },
                        "x_datazoom": false,
                        "y_datazoom": false,
                        "xAxis": {
                            "type": "category",
                            "name": "时间",
                            "fontsize": 12,
                            "col_name": "时间",
                            "time_format": "HH:mm:ss.SSS"
                        },
                        "yAxis": [
                            {
                                "type": "value",
                                "name": "股价",
                                "col_name": "时间",
                                "position": "left",
                                "offset": 1,
                                "fontsize": 12,
                                "with_zero": false
                            },
                            {
                                "type": "value",
                                "name": "主力净流入",
                                "fontsize": 12,
                                "col_name": "时间",
                                "with_zero": false,
                                "position": "right",
                                "offset": 0
                            }
                        ],
                        "series": [
                            {
                                "col_name": "股价",
                                "name": "股价",
                                "yAxisIndex": 0,
                                "type": "LINE",
                                "color": "#ffb700",
                                "line_type": "solid",
                                "is_filled": false,
                                "end_label": false,
                                "opacity": 0.2,
                                "line_width": 0.3
                            },
                            {
                                "col_name": "主力净流入",
                                "name": "主力净流入",
                                "type": "LINE",
                                "color": "#0e3fe2",
                                "yAxisIndex": 1,
                                "line_type": "solid",
                                "is_filled": false,
                                "end_label": false
                            }
                        ]
                    }
                }
            ],
            "page_count": 1,
            "auto_expand": true
        }
    },
    "createTime": "2025.05.28 15:02:36.319",
    "permission": 0
}