Last active
September 21, 2023 05:34
-
-
Save inesusvet/6f860def3d74768b0682acf376f53926 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module.exports = { | |
package: null, | |
syntax: "proto2", | |
messages: [{ | |
name: "Msg", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "Commands", | |
name: "command_number", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "bytes", | |
name: "data", | |
id: 2 | |
}], | |
enums: [{ | |
name: "Commands", | |
syntax: "proto2", | |
values: [{ | |
name: "chart_create_session", | |
id: 0 | |
}, { | |
name: "chart_delete_session", | |
id: 1 | |
}, { | |
name: "resolve_symbol", | |
id: 2 | |
}, { | |
name: "create_series", | |
id: 3 | |
}, { | |
name: "create_study", | |
id: 4 | |
}, { | |
name: "message", | |
id: 5 | |
}, { | |
name: "timescale_update", | |
id: 6 | |
}, { | |
name: "du", | |
id: 7 | |
}, { | |
name: "series_loading", | |
id: 8 | |
}, { | |
name: "series_completed", | |
id: 9 | |
}, { | |
name: "series_error", | |
id: 10 | |
}, { | |
name: "series_deleted", | |
id: 11 | |
}, { | |
name: "series_timeframe", | |
id: 12 | |
}, { | |
name: "first_bar_time", | |
id: 13 | |
}, { | |
name: "study_loading", | |
id: 14 | |
}, { | |
name: "study_completed", | |
id: 15 | |
}, { | |
name: "switch_timezone", | |
id: 16 | |
}, { | |
name: "request_studies_metadata", | |
id: 17 | |
}, { | |
name: "remove_series", | |
id: 18 | |
}, { | |
name: "modify_series", | |
id: 19 | |
}, { | |
name: "request_more_data", | |
id: 20 | |
}, { | |
name: "get_first_bar_time", | |
id: 21 | |
}, { | |
name: "create_child_study", | |
id: 22 | |
}, { | |
name: "remove_study", | |
id: 23 | |
}, { | |
name: "modify_study", | |
id: 24 | |
}, { | |
name: "create_pointset", | |
id: 25 | |
}, { | |
name: "symbol_resolved", | |
id: 26 | |
}, { | |
name: "study_deleted", | |
id: 27 | |
}, { | |
name: "protocol_error", | |
id: 28 | |
}, { | |
name: "critical_error", | |
id: 29 | |
}, { | |
name: "set_auth_token", | |
id: 30 | |
}, { | |
name: "studies_metadata", | |
id: 31 | |
}, { | |
name: "set_data_quality", | |
id: 32 | |
}, { | |
name: "quote_create_session", | |
id: 33 | |
}, { | |
name: "quote_set_fields", | |
id: 34 | |
}, { | |
name: "quote_delete_session", | |
id: 35 | |
}, { | |
name: "quote_add_symbols", | |
id: 36 | |
}, { | |
name: "quote_remove_symbols", | |
id: 37 | |
}, { | |
name: "quote_switch_timezone", | |
id: 38 | |
}, { | |
name: "quote_fast_symbols", | |
id: 39 | |
}, { | |
name: "quote_hibernate_all", | |
id: 40 | |
}, { | |
name: "qsd", | |
id: 41 | |
}, { | |
name: "quote_list_fields", | |
id: 42 | |
}, { | |
name: "depth_create_session", | |
id: 43 | |
}, { | |
name: "depth_delete_session", | |
id: 44 | |
}, { | |
name: "depth_set_symbol", | |
id: 45 | |
}, { | |
name: "depth_clear_symbol", | |
id: 46 | |
}, { | |
name: "depth_set_scale", | |
id: 47 | |
}, { | |
name: "depth_symbol_success", | |
id: 48 | |
}, { | |
name: "depth_symbol_error", | |
id: 49 | |
}, { | |
name: "depth_symbol_cleared", | |
id: 50 | |
}, { | |
name: "dd", | |
id: 51 | |
}, { | |
name: "depth_bar_last_value", | |
id: 52 | |
}, { | |
name: "remove_pointset", | |
id: 53 | |
}, { | |
name: "study_error", | |
id: 54 | |
}, { | |
name: "modify_pointset", | |
id: 55 | |
}, { | |
name: "switch_protocol", | |
id: 56 | |
}, { | |
name: "symbol_error", | |
id: 57 | |
}, { | |
name: "request_more_tickmarks", | |
id: 58 | |
}, { | |
name: "tickmark_update", | |
id: 59 | |
}, { | |
name: "error_message", | |
id: 60 | |
}, { | |
name: "wrong_message_type", | |
id: 61 | |
}, { | |
name: "mock_fire_tick", | |
id: 62 | |
}, { | |
name: "pointset_error", | |
id: 63 | |
}, { | |
name: "quote_fire_tick", | |
id: 64 | |
}, { | |
name: "quote_fire_crash", | |
id: 65 | |
}, { | |
name: "child_study_rebind", | |
id: 66 | |
}] | |
}] | |
}, { | |
name: "chart_create_session", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "parameters", | |
id: 2 | |
}] | |
}, { | |
name: "chart_delete_session", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}] | |
}, { | |
name: "switch_timezone", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "timezone", | |
id: 2 | |
}] | |
}, { | |
name: "request_studies_metadata", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "meta_name", | |
id: 2 | |
}] | |
}, { | |
name: "resolve_symbol", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "resolve_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 3 | |
}] | |
}, { | |
name: "symbol_error", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}, { | |
rule: "repeated", | |
type: "string", | |
name: "reason", | |
id: 3 | |
}] | |
}, { | |
name: "create_series", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "resolve_name", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "resolution", | |
id: 5 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "bars", | |
id: 6 | |
}] | |
}, { | |
name: "remove_series", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}] | |
}, { | |
name: "modify_series", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "resolve_name", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "resolution", | |
id: 5 | |
}] | |
}, { | |
name: "request_more_data", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "count", | |
id: 3 | |
}] | |
}, { | |
name: "get_first_bar_time", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "resolution", | |
id: 3 | |
}] | |
}, { | |
name: "create_study", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "parent", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study", | |
id: 5 | |
}, { | |
rule: "optional", | |
type: "bytes", | |
name: "inputs", | |
id: 6 | |
}] | |
}, { | |
name: "create_child_study", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "parent", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study", | |
id: 5 | |
}, { | |
rule: "optional", | |
type: "bytes", | |
name: "inputs", | |
id: 6 | |
}] | |
}, { | |
name: "child_study_rebind", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "parent", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study", | |
id: 5 | |
}, { | |
rule: "optional", | |
type: "bytes", | |
name: "inputs", | |
id: 6 | |
}] | |
}, { | |
name: "remove_study", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study_name", | |
id: 2 | |
}] | |
}, { | |
name: "modify_study", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "bytes", | |
name: "inputs", | |
id: 4 | |
}] | |
}, { | |
name: "create_pointset", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "ps_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "interval", | |
id: 5 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "points", | |
id: 6 | |
}] | |
}, { | |
name: "modify_pointset", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "ps_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "points", | |
id: 4 | |
}] | |
}, { | |
name: "remove_pointset", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "ps_name", | |
id: 2 | |
}] | |
}, { | |
name: "quote_create_session", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}] | |
}, { | |
name: "quote_set_fields", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "fields", | |
id: 2 | |
}] | |
}, { | |
name: "quote_delete_session", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}] | |
}, { | |
name: "quote_add_symbols", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbols", | |
id: 2 | |
}] | |
}, { | |
name: "quote_remove_symbols", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "repeated", | |
type: "string", | |
name: "symbols", | |
id: 2 | |
}] | |
}, { | |
name: "quote_switch_timezone", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "timezone", | |
id: 2 | |
}] | |
}, { | |
name: "quote_fast_symbols", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbols", | |
id: 2 | |
}] | |
}, { | |
name: "quote_hibernate_all", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}] | |
}, { | |
name: "quote_fire_tick", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}] | |
}, { | |
name: "quote_fire_crash", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}] | |
}, { | |
name: "depth_create_session", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "multiplier", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "viewport_width", | |
id: 3 | |
}] | |
}, { | |
name: "depth_delete_session", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}] | |
}, { | |
name: "depth_set_symbol", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}] | |
}, { | |
name: "depth_clear_symbol", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}] | |
}, { | |
name: "depth_set_scale", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "scale", | |
id: 2 | |
}] | |
}, { | |
name: "set_auth_token", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "token", | |
id: 1 | |
}] | |
}, { | |
name: "set_data_quality", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "quality", | |
id: 1 | |
}] | |
}, { | |
name: "request_more_tickmarks", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "bars", | |
id: 3 | |
}] | |
}, { | |
name: "switch_protocol", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "DataType", | |
name: "protocol", | |
id: 1 | |
}], | |
enums: [{ | |
name: "DataType", | |
syntax: "proto2", | |
values: [{ | |
name: "json", | |
id: 0 | |
}, { | |
name: "protobuf", | |
id: 1 | |
}] | |
}] | |
}, { | |
name: "mock_fire_tick", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "time", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "price", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "size", | |
id: 5 | |
}] | |
}, { | |
name: "message", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "text", | |
id: 1 | |
}] | |
}, { | |
name: "protocol_error", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "text", | |
id: 1 | |
}] | |
}, { | |
name: "critical_error", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "reason", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "info", | |
id: 3 | |
}] | |
}, { | |
name: "error_message", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "params", | |
id: 2 | |
}] | |
}, { | |
name: "wrong_message_type", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "fail_message", | |
id: 1 | |
}] | |
}, { | |
name: "series_loading", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}] | |
}, { | |
name: "series_completed", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "update_mode", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 4 | |
}] | |
}, { | |
name: "series_error", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "ser", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "node", | |
id: 5 | |
}] | |
}, { | |
name: "series_deleted", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}] | |
}, { | |
name: "series_timeframe", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "left", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "right", | |
id: 5 | |
}] | |
}, { | |
name: "first_bar_time", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol_id", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "time", | |
id: 3 | |
}] | |
}, { | |
name: "study_loading", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}] | |
}, { | |
name: "study_completed", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 4 | |
}] | |
}, { | |
name: "study_deleted", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}] | |
}, { | |
name: "study_error", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "study_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "reason", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "node", | |
id: 5 | |
}] | |
}, { | |
name: "timescale_update", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "timescale", | |
name: "timescale", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "objects", | |
name: "objects", | |
id: 3 | |
}] | |
}, { | |
name: "du", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "objects", | |
name: "objects", | |
id: 2 | |
}] | |
}, { | |
name: "timescale", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "int32", | |
name: "index", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "zoffset", | |
id: 2 | |
}, { | |
rule: "repeated", | |
type: "double", | |
name: "changes", | |
id: 3 | |
}, { | |
rule: "repeated", | |
type: "marks", | |
name: "marks", | |
id: 4 | |
}] | |
}, { | |
name: "tickmark_update", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "index", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "int32", | |
name: "zoffset", | |
id: 3 | |
}, { | |
rule: "repeated", | |
type: "double", | |
name: "changes", | |
id: 4 | |
}, { | |
rule: "repeated", | |
type: "marks", | |
name: "marks", | |
id: 5 | |
}] | |
}, { | |
name: "marks", | |
syntax: "proto2", | |
fields: [{ | |
rule: "repeated", | |
type: "double", | |
name: "value", | |
id: 1 | |
}] | |
}, { | |
name: "objects", | |
syntax: "proto2", | |
fields: [{ | |
rule: "repeated", | |
type: "series", | |
name: "series", | |
id: 1 | |
}] | |
}, { | |
name: "series", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "series_name", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "node", | |
id: 2 | |
}, { | |
rule: "repeated", | |
type: "s", | |
name: "data", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "ns", | |
name: "ns", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 5 | |
}] | |
}, { | |
name: "ns", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "d", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "bool", | |
name: "nochange", | |
id: 2 | |
}, { | |
rule: "repeated", | |
type: "int32", | |
name: "indexes", | |
id: 3 | |
}] | |
}, { | |
name: "st", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "int32", | |
name: "i", | |
id: 1 | |
}, { | |
rule: "repeated", | |
type: "double", | |
name: "value", | |
id: 2 | |
}] | |
}, { | |
name: "s", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "int32", | |
name: "i", | |
id: 1 | |
}, { | |
rule: "repeated", | |
type: "double", | |
name: "value", | |
id: 2 | |
}] | |
}, { | |
name: "symbol_resolved", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol_info", | |
id: 3 | |
}] | |
}, { | |
name: "studies_metadata", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "meta_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "metadata", | |
id: 3 | |
}] | |
}, { | |
name: "qsd", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "status", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "values", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "lp", | |
id: 5 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "ch", | |
id: 6 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "chp", | |
id: 7 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "high_price", | |
id: 8 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "low_price", | |
id: 9 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "volume", | |
id: 10 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "rtc", | |
id: 11 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "rch", | |
id: 12 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "rchp", | |
id: 13 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "bid", | |
id: 14 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "ask", | |
id: 15 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "bid_size", | |
id: 16 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "ask_size", | |
id: 17 | |
}, { | |
rule: "optional", | |
type: "series_data", | |
name: "series_data", | |
id: 18 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "rest", | |
id: 19 | |
}] | |
}, { | |
name: "qsd2", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol_name", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "status", | |
id: 3 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "values", | |
id: 4 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "lp", | |
id: 5 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "ch", | |
id: 6 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "chp", | |
id: 7 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "high_price", | |
id: 8 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "low_price", | |
id: 9 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "volume", | |
id: 10 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "rtc", | |
id: 11 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "rch", | |
id: 12 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "rchp", | |
id: 13 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "bid", | |
id: 14 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "ask", | |
id: 15 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "bid_size", | |
id: 16 | |
}, { | |
rule: "optional", | |
type: "float", | |
name: "ask_size", | |
id: 17 | |
}, { | |
rule: "optional", | |
type: "series_data", | |
name: "series_data", | |
id: 18 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "rest", | |
id: 19 | |
}] | |
}, { | |
name: "series_data", | |
syntax: "proto2", | |
fields: [{ | |
rule: "repeated", | |
type: "float", | |
name: "time", | |
id: 1 | |
}, { | |
rule: "repeated", | |
type: "float", | |
name: "value", | |
id: 2 | |
}] | |
}, { | |
name: "quote_list_fields", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "fields", | |
id: 2 | |
}] | |
}, { | |
name: "depth_symbol_success", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}] | |
}, { | |
name: "depth_symbol_error", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "reason", | |
id: 3 | |
}] | |
}, { | |
name: "depth_symbol_cleared", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}] | |
}, { | |
name: "dd", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "depth_data", | |
name: "depth_data", | |
id: 2 | |
}] | |
}, { | |
name: "depth_data", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "left", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "right", | |
id: 3 | |
}, { | |
rule: "repeated", | |
type: "bs", | |
name: "bids", | |
id: 4 | |
}, { | |
rule: "repeated", | |
type: "bs", | |
name: "asks", | |
id: 5 | |
}] | |
}, { | |
name: "bs", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "double", | |
name: "price", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "volume", | |
id: 2 | |
}] | |
}, { | |
name: "depth_bar_last_value", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "symbol", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "double", | |
name: "last_value", | |
id: 3 | |
}] | |
}, { | |
name: "pointset_error", | |
syntax: "proto2", | |
fields: [{ | |
rule: "optional", | |
type: "string", | |
name: "session", | |
id: 1 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "set_id", | |
id: 2 | |
}, { | |
rule: "optional", | |
type: "string", | |
name: "turnaround", | |
id: 3 | |
}] | |
}], | |
isNamespace: !0 | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
syntax = "proto2"; | |
package tv; | |
message Msg { | |
optional Commands command_number = 1; | |
optional bytes data = 2; | |
enum Commands { | |
chart_create_session = 0; | |
chart_delete_session = 1; | |
resolve_symbol = 2; | |
create_series = 3; | |
create_study = 4; | |
message = 5; | |
timescale_update = 6; | |
du = 7; | |
series_loading = 8; | |
series_completed = 9; | |
series_error = 10; | |
series_deleted = 11; | |
series_timeframe = 12; | |
first_bar_time = 13; | |
study_loading = 14; | |
study_completed = 15; | |
switch_timezone = 16; | |
request_studies_metadata = 17; | |
remove_series = 18; | |
modify_series = 19; | |
request_more_data = 20; | |
get_first_bar_time = 21; | |
create_child_study = 22; | |
remove_study = 23; | |
modify_study = 24; | |
create_pointset = 25; | |
symbol_resolved = 26; | |
study_deleted = 27; | |
protocol_error = 28; | |
critical_error = 29; | |
set_auth_token = 30; | |
studies_metadata = 31; | |
set_data_quality = 32; | |
quote_create_session = 33; | |
quote_set_fields = 34; | |
quote_delete_session = 35; | |
quote_add_symbols = 36; | |
quote_remove_symbols = 37; | |
quote_switch_timezone = 38; | |
quote_fast_symbols = 39; | |
quote_hibernate_all = 40; | |
qsd = 41; | |
quote_list_fields = 42; | |
depth_create_session = 43; | |
depth_delete_session = 44; | |
depth_set_symbol = 45; | |
depth_clear_symbol = 46; | |
depth_set_scale = 47; | |
depth_symbol_success = 48; | |
depth_symbol_error = 49; | |
depth_symbol_cleared = 50; | |
dd = 51; | |
depth_bar_last_value = 52; | |
remove_pointset = 53; | |
study_error = 54; | |
modify_pointset = 55; | |
switch_protocol = 56; | |
symbol_error = 57; | |
request_more_tickmarks = 58; | |
tickmark_update = 59; | |
error_message = 60; | |
wrong_message_type = 61; | |
mock_fire_tick = 62; | |
pointset_error = 63; | |
quote_fire_tick = 64; | |
quote_fire_crash = 65; | |
child_study_rebind = 66; | |
} | |
} | |
message set_auth_token { | |
optional string token = 1; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
""" | |
To start - install the dependencies | |
`pip install websocket-client requests` | |
Before start you should set env-var COOKIE to actual cookies from tradingview.com | |
""" | |
import copy | |
import functools | |
import json | |
import logging | |
import os | |
from pprint import pprint as pp | |
import subprocess | |
import sys | |
import time | |
import requests | |
import websocket | |
logging.basicConfig(level=logging.INFO) | |
logger = logging.getLogger(__name__) | |
COOKIE = os.environ.get('COOKIE', '') | |
user_cookie = {'Cookie': COOKIE} | |
accept_json = {'Accept': 'application/json'} | |
content_json = {'Content-Type': 'application/json'} | |
def merge_dicts(origin_dict, *optional_dicts): | |
copy_dict = copy.deepcopy(origin_dict) | |
for optional in optional_dicts: | |
copy_dict.update(optional) | |
return copy_dict | |
def get_cookie_value(headers, cookie_name): | |
for header in headers: | |
if header != 'Set-Cookie': | |
continue | |
parts = headers[header].split(';') | |
for part in parts: | |
name, value = part.strip().split('=') | |
if name == cookie_name: | |
return value | |
def pack_json(message, *args): | |
return json.dumps({ | |
'm': message, | |
'p': args, | |
}, indent=None, separators=(',', ':')) | |
def pack_pb(command, data): | |
cmd = 'node pack.js'.split(' ') + [command, data] | |
pipe = subprocess.Popen(cmd, stdout=subprocess.PIPE) | |
out, err = pipe.communicate() | |
return out | |
def unpack_pb(text): | |
message = pb.Msg() | |
message.ParseFromString(text) | |
name = PB_COMMAND_NAMES[message.command_number] | |
return name, message.data | |
def get_session(root): | |
url = root + '/grab_session/' | |
headers = merge_dicts(accept_json, user_cookie, content_json) | |
resp = requests.post(url, headers=headers, allow_redirects=False) | |
assert resp.status_code == 200 | |
assert resp.json() == {'status': 'success'} | |
return get_cookie_value(resp.headers, 'sessionid') | |
def quote_token(root): | |
url = root + '/quote_token/' | |
headers = merge_dicts(accept_json, user_cookie, content_json) | |
resp = requests.post(url, json={'grabSession': True}, headers=headers, allow_redirects=False) | |
assert resp.status_code == 200 | |
text = resp.json() | |
token = text.split(':')[0] # NOTE: There is a strange message in response. It looks like colon-separated values - first of them is the longest | |
return token | |
def on_error(ws, error): | |
logger.error(error) | |
def on_close(ws): | |
logger.warning('Closed') | |
def authorize(ws, token): | |
message = as_binary(pack_json('set_auth_token', token)) | |
ws.send(message) | |
def as_binary(message): | |
return '~m~%d~m~%s' % (len(message), message) | |
def switch_protocol(ws, protocol): | |
message = as_binary(pack_json('switch_protocol', protocol)) | |
ws.send(message) | |
def on_open(ws, token=None): | |
logger.info('Opened') | |
# TODO: check protobuf-maintenance if yes - use json instead protobuf | |
switch_protocol(ws, 'protobuf') | |
authorize(ws, token) | |
def on_message(ws, message): | |
logger.info('%f < %s', time.time(), message) | |
# name, body = unpack_pb(message) | |
# logger.info('parsed %s < %s', name, body) | |
# switch_protocol(ws, 'protobuf') | |
def main(): | |
TV_ROOT = root = 'https://www.tradingview.com' | |
WS_URL = 'wss://prodata.tradingview.com/socket.io/websocket' | |
# TODO: read sessionid | |
sessionid = get_session(root) | |
logger.info('Session = %s', sessionid) | |
token = quote_token(root) | |
# Print request/response ot stdout | |
# websocket.enableTrace(True) | |
ws = websocket.WebSocketApp( | |
WS_URL, | |
on_close=on_close, | |
on_error=on_error, | |
on_message=on_message, | |
) | |
ws.on_open = functools.partial(on_open, token=token) | |
ws.run_forever() | |
if __name__ == '__main__': | |
main() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Не могу справиться с ошибкой протокола