boosted.api.api
1# Copyright (C) 2020 Gradient Boosted Investments, Inc. - All Rights Reserved 2 3import datetime 4import logging 5from datetime import timedelta 6from typing import Any, Dict, List, Literal, Optional, Union 7 8import pandas as pd 9 10from boosted.api.api_client import BoostedClient, convert_date 11from boosted.api.api_type import ( 12 BoostedAPIException, 13 BoostedDate, 14 DataAddType, 15 DataSetFrequency, 16 DataSetSubType, 17 DataSetType, 18 GbiIdSecurity, 19 HedgeExperiment, 20 HedgeExperimentDetails, 21 HedgeExperimentScenario, 22 Language, 23 NewsHorizon, 24 PortfolioSettings, 25 ThemeUniverse, 26 hedge_experiment_type, 27) 28from boosted.api.api_util import infer_dataset_schema 29 30logger = logging.getLogger("boosted.api") 31logging.basicConfig() 32 33 34def inferDependentDataSetSchema(name, df, infer_from_column_names=False): 35 """ 36 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 37 38 Parameters 39 ---------- 40 datasetName: str 41 Name for this dataset. 42 df: pandas.DataFrame 43 Pandas DataFrame containing your data. The index must be 44 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 45 infer_from_column_names: bool 46 Allows creation of dataset schemas with more flexible identifier columns. 47 Identifier column names must be specified equal to (case and whitespace insensitive) 48 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 49 together as a block in the first N columns of your dataset, where N is the number of 50 identifiers. 51 52 Returns 53 ------- 54 DatasetConfig 55 A DatasetConfig can be used to create a new dataset. 56 """ 57 return infer_dataset_schema( 58 name, df, DataSetType.STOCK, infer_from_column_names=infer_from_column_names 59 ) 60 61 62def inferCustomSecurityDailyDataSetSchema( 63 df, infer_from_column_names=False, schema_name="custom_security_daily" 64): 65 """ 66 Creates a custom security daily schema by inferring the contents from a Pandas DataFrame. 67 68 Parameters 69 ---------- 70 df: pandas.DataFrame 71 Pandas DataFrame containing your data. The index must be 72 DatetimeIndex. The columns must be the identifiers: 73 e.g. (custom_security), followed by any features in the dataset. 74 75 For custom security, we expect at minimum a custom security identifier and 76 a close price. The CSV header should look like this: 77 custom_security,daily_close 78 with support for the following optional pricing data columns in total: 79 daily_open 80 daily_close 81 daily_vwap 82 daily_high 83 daily_low 84 daily_bid 85 daily_ask 86 daily_volume (default high volume) 87 daily_mcap (default high mcap) 88 89 infer_from_column_names: bool 90 Allows creation of dataset schemas with more flexible identifier columns. 91 Identifier column names must be specified equal to (case and whitespace insensitive) 92 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 93 together as a block in the first N columns of your dataset, where N is the number of 94 identifiers. 95 96 Returns 97 ------- 98 DatasetConfig 99 A DatasetConfig can be used to create a new dataset. 100 """ 101 return infer_dataset_schema( 102 schema_name, 103 df, 104 DataSetType.SECURITIES_DAILY, 105 infer_from_column_names=infer_from_column_names, 106 ) 107 108 109def inferDependentHistoricalQuarterlyDataSetSchema( 110 name, df, infer_dataset_report_period=True, infer_from_column_names=False 111): 112 """ 113 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 114 115 Parameters 116 ---------- 117 datasetName: str 118 Name for this dataset. 119 df: pandas.DataFrame 120 Pandas DataFrame containing your data. The index must be 121 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 122 infer_from_column_names: bool 123 Allows creation of dataset schemas with more flexible identifier columns. 124 Identifier column names must be specified equal to (case and whitespace insensitive) 125 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 126 together as a block in the first N columns of your dataset, where N is the number of 127 identifiers. 128 infer_dataset_report_period: bool 129 Allow the report period to be inferred based on the report date 130 131 Returns 132 ------- 133 DatasetConfig 134 A DatasetConfig can be used to create a new dataset. 135 """ 136 return infer_dataset_schema( 137 name, 138 df, 139 DataSetType.STOCK, 140 dataset_subtype=DataSetSubType.SPARSE_HIST, 141 dataset_frequency=DataSetFrequency.QUARTERLY, 142 infer_dataset_report_period=infer_dataset_report_period, 143 infer_from_column_names=infer_from_column_names, 144 ) 145 146 147def inferDependentForwardQuarterlyDataSetSchema( 148 name, df, infer_dataset_report_period=True, infer_from_column_names=False 149): 150 """ 151 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 152 153 Parameters 154 ---------- 155 datasetName: str 156 Name for this dataset. 157 df: pandas.DataFrame 158 Pandas DataFrame containing your data. The index must be 159 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 160 infer_from_column_names: bool 161 Allows creation of dataset schemas with more flexible identifier columns. 162 Identifier column names must be specified equal to (case and whitespace insensitive) 163 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 164 together as a block in the first N columns of your dataset, where N is the number of 165 identifiers. 166 infer_dataset_report_period: bool 167 Allow the report period to be inferred based on the report date 168 169 Returns 170 ------- 171 DatasetConfig 172 A DatasetConfig can be used to create a new dataset. 173 """ 174 return infer_dataset_schema( 175 name, 176 df, 177 DataSetType.STOCK, 178 dataset_subtype=DataSetSubType.SPARSE_FWD, 179 dataset_frequency=DataSetFrequency.QUARTERLY, 180 infer_dataset_report_period=infer_dataset_report_period, 181 infer_from_column_names=infer_from_column_names, 182 ) 183 184 185def inferIndependentDataSetSchema(name, df): 186 """ 187 Creates a independent dataset schema by inferring the contents from a Pandas DataFrame. 188 189 Parameters 190 ---------- 191 datasetName: str 192 Name for this dataset. 193 df: pandas.DataFrame 194 Pandas DataFrame containing your data. The index must be 195 DatetimeIndex. The first column must be a unique custom security identifier 196 197 Returns 198 ------- 199 DatasetConfig 200 A DatasetConfig can be used to create a new dataset. 201 """ 202 return infer_dataset_schema(name, df, DataSetType.STRATEGY, infer_from_column_names=False) 203 204 205def inferGlobalDataSetSchema(name, df): 206 """ 207 Creates a independent dataset schema by inferring the contents from a Pandas DataFrame. 208 209 Parameters 210 ---------- 211 datasetName: str 212 Name for this dataset. 213 df: pandas.DataFrame 214 Pandas DataFrame containing your data. The index must be 215 DatetimeIndex. 216 217 Returns 218 ------- 219 DatasetConfig 220 A DatasetConfig can be used to create a new dataset. 221 """ 222 return infer_dataset_schema(name, df, DataSetType.GLOBAL, infer_from_column_names=False) 223 224 225def getDataSetSchema(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 226 """ 227 Retrieves a DataSetConfig representing the schema of an existing dataset. 228 229 Parameters 230 ---------- 231 apikey: str 232 API key provided by Boosted. This key should be protected as a secret. 233 dataset_id: str 234 Dataset ID. Can be from the output of addIndependentDataset or be found 235 in your Custom Data listing in Boosted Insights. 236 proxy: str 237 Your organization may require the use of a proxy for access. 238 The address of a HTTPS proxy in the format of <address>:<port>. 239 Examples are "123.456.789:123" or "my.proxy.com:123". 240 Do not prepend with "https://". 241 disable_verify_ssl: bool 242 Your networking setup may be behind a firewall which performs SSL 243 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 244 to point to the location of a custom certificate bundle, or set this 245 parameter to true to disable SSL verification as a workaround. 246 247 Returns 248 ------- 249 DataSetConfig 250 A DataSetConfig can be used to create a new dataset. 251 """ 252 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 253 return client.get_dataset_schema(dataset_id) 254 255 256def addDependentDataset( 257 apikey, 258 dataset, 259 datasetName="DependentDataset", 260 datasetConfig=None, 261 proxy=None, 262 disable_verify_ssl=False, 263 timeout: int = 600, 264 block: bool = True, 265): 266 """ 267 Creates a new dependent dataset. 268 269 Creates a new dataset by inferring a schema from your dataset. This will 270 also upload the dataset. 271 272 See http://docs.insights.boosted.ai/integrated-data for more information 273 on formatting. 274 275 Parameters 276 ---------- 277 apikey: str 278 API key provided by Boosted. This key should be protected as a secret. 279 dataset: pandas.DataFrame 280 Pandas DataFrame containing your data. The index must be 281 DatetimeIndex. The first columns must be ISIN, Country, Currency, 282 or comprise all identifier columns in the dataset schema if a schema was 283 specified 284 datasetName: str 285 Name for this dataset. 286 datasetConfig: DatasetConfig 287 A pre-configured dataset schema 288 proxy: str 289 Your organization may require the use of a proxy for access. 290 The address of a HTTPS proxy in the format of <address>:<port>. 291 Examples are "123.456.789:123" or "my.proxy.com:123". 292 Do not prepend with "https://". 293 disable_verify_ssl: bool 294 Your networking setup may be behind a firewall which performs SSL 295 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 296 to point to the location of a custom certificate bundle, or set this 297 parameter to true to disable SSL verification as a workaround. 298 timeout: int = 600 299 Number of seconds before a timeout error should be triggered. 300 block: bool = True 301 Whether the python process should block until the dataset is fully 302 uploaded and processed. 303 304 Returns 305 ------- 306 str 307 Dataset ID of the newly created dataset. 308 """ 309 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 310 return client.add_dependent_dataset( 311 dataset, datasetName, datasetConfig, timeout=timeout, block=block 312 ) 313 314 315def addIndependentDataset( 316 apikey, 317 dataset, 318 datasetName="IndependentDataset", 319 datasetConfig=None, 320 proxy=None, 321 disable_verify_ssl=False, 322 timeout: int = 600, 323 block: bool = True, 324): 325 """ 326 Creates a new independent dataset. 327 328 Creates a new dataset by inferring a schema from your dataset. This will 329 also upload the dataset. 330 331 See http://docs.insights.boosted.ai/independent-data for more information 332 on formatting. 333 334 Parameters 335 ---------- 336 apikey: str 337 API key provided by Boosted. This key should be protected as a secret. 338 dataset: pandas.DataFrame 339 Pandas DataFrame containing your data. The index must be 340 DatetimeIndex. The first column must be a unique custom security identifier 341 datasetName: str 342 Name for this dataset. 343 datasetConfig: DatasetConfig 344 A pre-configured dataset schema 345 proxy: str 346 Your organization may require the use of a proxy for access. 347 The address of a HTTPS proxy in the format of <address>:<port>. 348 Examples are "123.456.789:123" or "my.proxy.com:123". 349 Do not prepend with "https://". 350 disable_verify_ssl: bool 351 Your networking setup may be behind a firewall which performs SSL 352 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 353 to point to the location of a custom certificate bundle, or set this 354 parameter to true to disable SSL verification as a workaround. 355 timeout: int = 600 356 Number of seconds before a timeout error should be triggered. 357 block: bool = True 358 Whether the python process should block until the dataset is fully 359 uploaded and processed. 360 361 Returns 362 ------- 363 str 364 Dataset ID of the newly created dataset. 365 """ 366 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 367 return client.add_independent_dataset( 368 dataset, datasetName, datasetConfig, timeout=timeout, block=block 369 ) 370 371 372def addGlobalDataset( 373 apikey, 374 dataset, 375 datasetName="GlobalDataset", 376 datasetConfig=None, 377 proxy=None, 378 disable_verify_ssl=False, 379 timeout: int = 600, 380 block: bool = True, 381): 382 """ 383 Creates a new global dataset. 384 385 Creates a new dataset by inferring a schema from your dataset. This will 386 also upload the dataset. 387 388 See http://docs.insights.boosted.ai/global-data for more information 389 on formatting. 390 391 Parameters 392 ---------- 393 apikey: str 394 API key provided by Boosted. This key should be protected as a secret. 395 dataset: pandas.DataFrame 396 Pandas DataFrame containing your data. The index must be 397 DatetimeIndex. 398 datasetName: str 399 Name for this dataset. 400 datasetConfig: DatasetConfig 401 A pre-configured dataset schema 402 proxy: str 403 Your organization may require the use of a proxy for access. 404 The address of a HTTPS proxy in the format of <address>:<port>. 405 Examples are "123.456.789:123" or "my.proxy.com:123". 406 Do not prepend with "https://". 407 disable_verify_ssl: bool 408 Your networking setup may be behind a firewall which performs SSL 409 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 410 to point to the location of a custom certificate bundle, or set this 411 parameter to true to disable SSL verification as a workaround. 412 timeout: int = 600 413 Number of seconds before a timeout error should be triggered. 414 block: bool = True 415 Whether the python process should block until the dataset is fully 416 uploaded and processed. 417 418 Returns 419 ------- 420 str 421 Dataset ID of the newly created dataset. 422 """ 423 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 424 return client.add_global_dataset( 425 dataset, datasetName, datasetConfig, timeout=timeout, block=block 426 ) 427 428 429def addCustomSecurityNamespaceMembers( 430 apikey, 431 namespace, 432 members, 433 proxy, 434 disable_verify_ssl=False, 435): 436 """ 437 Uploads namespace members (tickers, or stock identifiers) into the specified 438 security namespace. 439 440 Parameters 441 ---------- 442 apikey: str 443 API key provided by Boosted. This key should be protected as a secret. 444 namespace: str 445 Namespace to upload to. This is any string representing a private collection of 446 securities that you may refer to with the format <namespace>\\<symbol> 447 in other custom data uploads. 448 members: DataFrame | str 449 A CSV or dataframe representing a CSV containing the securities to upload 450 This tabular data should have columns 451 Symbol Country Currency Name 452 case sensitive, where country and currency are 3-letter ISO country/currency codes. 453 proxy: str 454 Your organization may require the use of a proxy for access. 455 The address of a HTTPS proxy in the format of <address>:<port>. 456 Examples are "123.456.789:123" or "my.proxy.com:123". 457 Do not prepend with "https://". 458 disable_verify_ssl: bool 459 Your networking setup may be behind a firewall which performs SSL 460 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 461 to point to the location of a custom certificate bundle, or set this 462 parameter to true to disable SSL verification as a workaround. 463 464 465 Returns 466 ------- 467 str 468 Dataset ID of the newly created dataset. 469 """ 470 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 471 return client.add_custom_security_namespace_members(namespace, members) 472 473 474def addCustomSecurityDailyData( 475 apikey, 476 namespace, 477 dataset, 478 datasetConfig=None, 479 proxy=None, 480 disable_verify_ssl=False, 481): 482 """ 483 Creates a new custom security daily dataset. 484 485 Creates a new dataset by inferring a schema from your dataset. This will 486 also upload the dataset. 487 488 See http://docs.insights.boosted.ai/integrated-data for more information 489 on formatting. 490 491 Parameters 492 ---------- 493 apikey: str 494 API key provided by Boosted. This key should be protected as a secret. 495 namespace: str 496 Namespace to upload to. This is any string representing a private collection of 497 securities that you may refer to with the format <namespace>\\<symbol> 498 in other custom data uploads. 499 dataset: pandas.DataFrame 500 Pandas DataFrame containing your data. The index must be 501 DatetimeIndex. 502 503 For custom security, we expect at minimum a custom security identifier and 504 a close price. The CSV header should look like this: 505 custom_security,daily_close 506 with support for the following pricing data fields in total: 507 daily_open 508 daily_close 509 daily_vwap 510 daily_high 511 daily_low 512 daily_bid 513 daily_ask 514 daily_volume (default high volume) 515 daily_mcap (default high mcap) 516 The custom security column should contain the symbols uploaded to the namespace above. 517 518 Please note that any missing values (nans, empty csv fields) are converted to 519 field-level defaults, which are usually 0.0 for pricing fields and a large 520 number for market cap and volume for assumed liquidity. 521 522 datasetConfig: DatasetConfig 523 A pre-configured dataset schema. 524 proxy: str 525 Your organization may require the use of a proxy for access. 526 The address of a HTTPS proxy in the format of <address>:<port>. 527 Examples are "123.456.789:123" or "my.proxy.com:123". 528 Do not prepend with "https://". 529 disable_verify_ssl: bool 530 Your networking setup may be behind a firewall which performs SSL 531 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 532 to point to the location of a custom certificate bundle, or set this 533 parameter to true to disable SSL verification as a workaround. 534 535 Returns 536 ------- 537 str 538 Dataset id of the dataset uploaded to through the namespace. 539 """ 540 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 541 return client.add_custom_security_daily_dataset(namespace, dataset, schema=datasetConfig) 542 543 544def exportDependentDataset( 545 apikey, 546 dataset_id, 547 start=None, 548 end=None, 549 proxy=None, 550 disable_verify_ssl=False, 551 timeout: int = 600, 552): 553 """ 554 Exports an existing dependent dataset. 555 556 Exports an existing dataset identified by a dataset ID. Returns the data 557 as a Pandas DataFrame. 558 559 Parameters 560 ---------- 561 apikey: str 562 API key provided by Boosted. This key should be protected as a secret. 563 dataset_id: str 564 Dataset ID. Can be from the output of addDependentDataset or be found 565 in your Custom Data listing in Boosted Insights. 566 start: datetime.date or YYYY-MM-DD string 567 The date from which data will be exported. 568 end: datetime.date or YYYY-MM-DD string 569 The date until which data will be exported. 570 proxy: str 571 Your organization may require the use of a proxy for access. 572 The address of a HTTPS proxy in the format of <address>:<port>. 573 Examples are "123.456.789:123" or "my.proxy.com:123". 574 Do not prepend with "https://". 575 disable_verify_ssl: bool 576 Your networking setup may be behind a firewall which performs SSL 577 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 578 to point to the location of a custom certificate bundle, or set this 579 parameter to true to disable SSL verification as a workaround. 580 timeout: int = 600 581 Number of seconds before a timeout error should be triggered. 582 583 Returns 584 ------- 585 pandas.DataFrame 586 Pandas DataFrame containing your data that will be indexed by the date. 587 The DataFrame schema is identical to the one used to upload a dataset. 588 """ 589 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 590 return client.export_dependent_data(dataset_id, start=start, end=end, timeout=timeout) 591 592 593def exportIndependentDataset( 594 apikey, 595 dataset_id, 596 start=(datetime.date.today() - timedelta(days=365 * 25)), 597 end=datetime.date.today(), 598 proxy=None, 599 disable_verify_ssl=False, 600 timeout: int = 600, 601): 602 """ 603 Exports an existing independent dataset. 604 605 Exports an existing dataset identified by a dataset ID. Returns the data 606 as a Pandas DataFrame. 607 608 Parameters 609 ---------- 610 apikey: str 611 API key provided by Boosted. This key should be protected as a secret. 612 dataset_id: str 613 Dataset ID. Can be from the output of addIndependentDataset or be found 614 in your Custom Data listing in Boosted Insights. 615 start: datetime.date or YYYY-MM-DD string 616 The date from which data will be exported. 617 end: datetime.date or YYYY-MM-DD string 618 The date until which data will be exported. 619 proxy: str 620 Your organization may require the use of a proxy for access. 621 The address of a HTTPS proxy in the format of <address>:<port>. 622 Examples are "123.456.789:123" or "my.proxy.com:123". 623 Do not prepend with "https://". 624 disable_verify_ssl: bool 625 Your networking setup may be behind a firewall which performs SSL 626 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 627 to point to the location of a custom certificate bundle, or set this 628 parameter to true to disable SSL verification as a workaround. 629 timeout: int = 600 630 Number of seconds before a timeout error should be triggered. 631 632 Returns 633 ------- 634 pandas.DataFrame 635 Pandas DataFrame containing your data that will be indexed by the date. 636 The DataFrame schema is identical to the one used to upload a dataset. 637 """ 638 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 639 return client.export_independent_data(dataset_id, start, end, timeout=timeout) 640 641 642def exportGlobalDataset( 643 apikey, 644 dataset_id, 645 start=(datetime.date.today() - timedelta(days=365 * 25)), 646 end=datetime.date.today(), 647 proxy=None, 648 disable_verify_ssl=False, 649 timeout: int = 600, 650): 651 """ 652 Exports an existing global dataset. 653 654 Exports an existing dataset identified by a dataset ID. Returns the data 655 as a Pandas DataFrame. 656 657 Parameters 658 ---------- 659 apikey: str 660 API key provided by Boosted. This key should be protected as a secret. 661 dataset_id: str 662 Dataset ID. Can be from the output of addGlobalDataset or be found 663 in your Custom Data listing in Boosted Insights. 664 start: datetime.date or YYYY-MM-DD string 665 The date from which data will be exported. 666 end: datetime.date or YYYY-MM-DD string 667 The date until which data will be exported. 668 proxy: str 669 Your organization may require the use of a proxy for access. 670 The address of a HTTPS proxy in the format of <address>:<port>. 671 Examples are "123.456.789:123" or "my.proxy.com:123". 672 Do not prepend with "https://". 673 disable_verify_ssl: bool 674 Your networking setup may be behind a firewall which performs SSL 675 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 676 to point to the location of a custom certificate bundle, or set this 677 parameter to true to disable SSL verification as a workaround. 678 timeout: int = 600 679 Number of seconds before a timeout error should be triggered. 680 681 Returns 682 ------- 683 pandas.DataFrame 684 Pandas DataFrame containing your data that will be indexed by the date. 685 The DataFrame schema is identical to the one used to upload a dataset. 686 """ 687 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 688 return client.export_global_data(dataset_id, start, end, timeout=timeout) 689 690 691def exportCustomSecurityDataset( 692 apikey, 693 dataset_id, 694 start=(datetime.date.today() - timedelta(days=365 * 25)), 695 end=datetime.date.today(), 696 proxy=None, 697 disable_verify_ssl=False, 698): 699 """ 700 Exports an existing custom security dataset. 701 702 Exports an existing dataset identified by a dataset ID. Returns the data 703 as a Pandas DataFrame. 704 705 Parameters 706 ---------- 707 apikey: str 708 API key provided by Boosted. This key should be protected as a secret. 709 dataset_id: str 710 Dataset ID of the custom security dataset. This is not a namespace, but 711 rather the output of addCustomSecurityDailyData. 712 start: datetime.date 713 Starting date range to export. Defaults to today minus 25 years. 714 end: datetime.date 715 Ending date range to export. Defaults to today. 716 proxy: str 717 Your organization may require the use of a proxy for access. 718 The address of a HTTPS proxy in the format of <address>:<port>. 719 Examples are "123.456.789:123" or "my.proxy.com:123". 720 Do not prepend with "https://". 721 disable_verify_ssl: bool 722 Your networking setup may be behind a firewall which performs SSL 723 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 724 to point to the location of a custom certificate bundle, or set this 725 parameter to true to disable SSL verification as a workaround. 726 727 Returns 728 ------- 729 pandas.DataFrame 730 Pandas DataFrame containing your data that will be indexed by the date. 731 The DataFrame schema is identical to the one used to upload a dataset. 732 """ 733 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 734 return client.export_custom_security_data(dataset_id, start=start, end=end) 735 736 737def addDependentData( 738 apikey, 739 dataset_id, 740 dataset, 741 proxy=None, 742 disable_verify_ssl=False, 743 timeout: int = 600, 744 block: bool = True, 745): 746 """ 747 Adds data to an existing dependent dataset. 748 749 This uploads the data in ``dataset`` to an existing dataset. Existing 750 date/ISIN pairs will be overwritten. 751 752 Parameters 753 ---------- 754 apikey: str 755 API key provided by Boosted. This key should be protected as a secret. 756 dataset_id: str 757 Dataset ID. Can be from the output of addDependentDataset or be found 758 in your Custom Data listing in Boosted Insights. 759 dataset: pandas.DataFrame 760 Pandas DataFrame containing your data. The index must be 761 DatetimeIndex. The first columns must comprise all identifier columns in the 762 dataset schema. 763 proxy: str 764 Your organization may require the use of a proxy for access. 765 The address of a HTTPS proxy in the format of <address>:<port>. 766 Examples are "123.456.789:123" or "my.proxy.com:123". 767 Do not prepend with "https://". 768 disable_verify_ssl: bool 769 Your networking setup may be behind a firewall which performs SSL 770 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 771 to point to the location of a custom certificate bundle, or set this 772 parameter to true to disable SSL verification as a workaround. 773 timeout: int = 600 774 Number of seconds before a timeout error should be triggered. 775 block: bool = True 776 Whether the python process should block until the dataset is fully 777 uploaded and processed. 778 779 Returns 780 ------- 781 None 782 """ 783 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 784 return client.add_dependent_data( 785 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 786 ) 787 788 789def addIndependentData( 790 apikey, 791 dataset_id, 792 dataset, 793 proxy=None, 794 disable_verify_ssl=False, 795 timeout: int = 600, 796 block: bool = True, 797): 798 """ 799 Adds data to an existing independent dataset. 800 801 This uploads the data in ``dataset`` to an existing dataset. Existing 802 dates will be overwritten. 803 804 Parameters 805 ---------- 806 apikey: str 807 API key provided by Boosted. This key should be protected as a secret. 808 dataset_id: str 809 Dataset ID. Can be from the output of addIndependentDataset or be found 810 in your Custom Data listing in Boosted Insights. 811 dataset: pandas.DataFrame 812 Pandas DataFrame containing your data. The index must be 813 DatetimeIndex. 814 proxy: str 815 Your organization may require the use of a proxy for access. 816 The address of a HTTPS proxy in the format of <address>:<port>. 817 Examples are "123.456.789:123" or "my.proxy.com:123". 818 Do not prepend with "https://". 819 disable_verify_ssl: bool 820 Your networking setup may be behind a firewall which performs SSL 821 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 822 to point to the location of a custom certificate bundle, or set this 823 parameter to true to disable SSL verification as a workaround. 824 timeout: int = 600 825 Number of seconds before a timeout error should be triggered. 826 block: bool = True 827 Whether the python process should block until the dataset is fully 828 uploaded and processed. 829 830 Returns 831 ------- 832 None 833 """ 834 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 835 return client.add_independent_data( 836 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 837 ) 838 839 840def addGlobalData( 841 apikey, 842 dataset_id, 843 dataset, 844 proxy=None, 845 disable_verify_ssl=False, 846 timeout: int = 600, 847 block: bool = True, 848): 849 """ 850 Adds data to an existing global dataset. 851 852 This uploads the data in ``dataset`` to an existing dataset. Existing 853 date/custom security identifier pairs will be overwritten. 854 855 Parameters 856 ---------- 857 apikey: str 858 API key provided by Boosted. This key should be protected as a secret. 859 dataset_id: str 860 Dataset ID. Can be from the output of addGlobalDataset or be found 861 in your Custom Data listing in Boosted Insights. 862 dataset: pandas.DataFrame 863 Pandas DataFrame containing your data. The index must be 864 DatetimeIndex. The first column must be custom security identifier 865 proxy: str 866 Your organization may require the use of a proxy for access. 867 The address of a HTTPS proxy in the format of <address>:<port>. 868 Examples are "123.456.789:123" or "my.proxy.com:123". 869 Do not prepend with "https://". 870 disable_verify_ssl: bool 871 Your networking setup may be behind a firewall which performs SSL 872 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 873 to point to the location of a custom certificate bundle, or set this 874 parameter to true to disable SSL verification as a workaround. 875 timeout: int = 600 876 Number of seconds before a timeout error should be triggered. 877 block: bool = True 878 Whether the python process should block until the dataset is fully 879 uploaded and processed. 880 881 Returns 882 ------- 883 None 884 """ 885 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 886 return client.add_global_data( 887 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 888 ) 889 890 891def addLiveDependentData( 892 apikey, 893 dataset_id, 894 dataset, 895 proxy=None, 896 disable_verify_ssl=False, 897 timeout: int = 600, 898 block: bool = True, 899): 900 """ 901 Adds live data to an existing dependent dataset. 902 903 This uploads the data in ``dataset`` to an existing dataset. Existing 904 date/ISIN pairs will be overwritten. 905 906 Parameters 907 ---------- 908 apikey: str 909 API key provided by Boosted. This key should be protected as a secret. 910 dataset_id: str 911 Dataset ID. Can be from the output of addDependentDataset or be found 912 in your Custom Data listing in Boosted Insights. 913 dataset: pandas.DataFrame 914 Pandas DataFrame containing your data. The index must be 915 DatetimeIndex. The first columns must be ISIN, Country, Currency. 916 proxy: str 917 Your organization may require the use of a proxy for access. 918 The address of a HTTPS proxy in the format of <address>:<port>. 919 Examples are "123.456.789:123" or "my.proxy.com:123". 920 Do not prepend with "https://". 921 disable_verify_ssl: bool 922 Your networking setup may be behind a firewall which performs SSL 923 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 924 to point to the location of a custom certificate bundle, or set this 925 parameter to true to disable SSL verification as a workaround. 926 timeout: int = 600 927 Number of seconds before a timeout error should be triggered. 928 block: bool = True 929 Whether the python process should block until the dataset is fully 930 uploaded and processed. 931 932 Returns 933 ------- 934 None 935 """ 936 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 937 return client.add_dependent_data( 938 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 939 ) 940 941 942def addLiveIndependentData( 943 apikey, 944 dataset_id, 945 dataset, 946 proxy=None, 947 disable_verify_ssl=False, 948 timeout: int = 600, 949 block: bool = True, 950): 951 """ 952 Adds live data to an existing independent dataset. 953 954 This uploads the data in ``dataset`` to an existing dataset. Existing 955 dates will be overwritten. 956 957 Parameters 958 ---------- 959 apikey: str 960 API key provided by Boosted. This key should be protected as a secret. 961 dataset_id: str 962 Dataset ID. Can be from the output of addIndependentDataset or be found 963 in your Custom Data listing in Boosted Insights. 964 dataset: pandas.DataFrame 965 Pandas DataFrame containing your data. The index must be 966 DatetimeIndex. 967 proxy: str 968 Your organization may require the use of a proxy for access. 969 The address of a HTTPS proxy in the format of <address>:<port>. 970 Examples are "123.456.789:123" or "my.proxy.com:123". 971 Do not prepend with "https://". 972 disable_verify_ssl: bool 973 Your networking setup may be behind a firewall which performs SSL 974 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 975 to point to the location of a custom certificate bundle, or set this 976 parameter to true to disable SSL verification as a workaround. 977 timeout: int = 600 978 Number of seconds before a timeout error should be triggered. 979 block: bool = True 980 Whether the python process should block until the dataset is fully 981 uploaded and processed. 982 983 Returns 984 ------- 985 None 986 """ 987 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 988 return client.add_independent_data( 989 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 990 ) 991 992 993def addLiveGlobalData( 994 apikey, 995 dataset_id, 996 dataset, 997 proxy=None, 998 disable_verify_ssl=False, 999 timeout: int = 600, 1000 block: bool = True, 1001): 1002 """ 1003 Adds live data to an existing global dataset. 1004 1005 This uploads the data in ``dataset`` to an existing dataset. Existing 1006 date/custom security identifier pairs will be overwritten. 1007 1008 Parameters 1009 ---------- 1010 apikey: str 1011 API key provided by Boosted. This key should be protected as a secret. 1012 dataset_id: str 1013 Dataset ID. Can be from the output of addGlobalDataset or be found 1014 in your Custom Data listing in Boosted Insights. 1015 dataset: pandas.DataFrame 1016 Pandas DataFrame containing your data. The index must be 1017 DatetimeIndex. The first column must be custom security identifier 1018 proxy: str 1019 Your organization may require the use of a proxy for access. 1020 The address of a HTTPS proxy in the format of <address>:<port>. 1021 Examples are "123.456.789:123" or "my.proxy.com:123". 1022 Do not prepend with "https://". 1023 disable_verify_ssl: bool 1024 Your networking setup may be behind a firewall which performs SSL 1025 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1026 to point to the location of a custom certificate bundle, or set this 1027 parameter to true to disable SSL verification as a workaround. 1028 timeout: int = 600 1029 Number of seconds before a timeout error should be triggered. 1030 block: bool = True 1031 Whether the python process should block until the dataset is fully 1032 uploaded and processed. 1033 1034 Returns 1035 ------- 1036 None 1037 """ 1038 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1039 return client.add_global_data( 1040 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 1041 ) 1042 1043 1044def queryDataset(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 1045 """ 1046 Queries the status, timerange of a dataset. 1047 1048 Returns meta-information about a dataset. This can be used to check the 1049 dateranges covered and the current status. 1050 1051 Parameters 1052 ---------- 1053 apikey: str 1054 API key provided by Boosted. This key should be protected as a secret. 1055 dataset_id: str 1056 Dataset ID. Can be from the output of addDependentDataset or be found 1057 in your Custom Data listing in Boosted Insights. 1058 proxy: str 1059 Your organization may require the use of a proxy for access. 1060 The address of a HTTPS proxy in the format of <address>:<port>. 1061 Examples are "123.456.789:123" or "my.proxy.com:123". 1062 Do not prepend with "https://". 1063 disable_verify_ssl: bool 1064 Your networking setup may be behind a firewall which performs SSL 1065 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1066 to point to the location of a custom certificate bundle, or set this 1067 parameter to true to disable SSL verification as a workaround. 1068 1069 Returns 1070 ------- 1071 dict: 1072 Dictionary containing meta-data about the dataset. 1073 1074 'created': <creation date>, 1075 'fileSize': <file size>, 1076 'id': <dataset ID>, 1077 'name': <dataset name>, 1078 'ownerId': <owner ID>, 1079 'region': <dataset region>, 1080 'status': {AVAILABLE|UPDATING|CREATING|ERROR}, 1081 'type': {STOCK|STRATEGY|GLOBAL}, 1082 'universeId': <universe ID>, 1083 'validFrom': [YYYY, MM, DD], 1084 'validTo': [YYYY, MM, DD]} 1085 1086 """ 1087 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1088 return client.query_dataset(dataset_id) 1089 1090 1091def getUniverse(apikey, model_id, date=None, proxy=None, disable_verify_ssl=False): 1092 """ 1093 Returns the universe members of a model. 1094 1095 Returns the members of the universe of a model. If no date is provided, 1096 effective date ranges will be returned. If a date is provided, only the 1097 universe members of that date are returned. The results are returned in a 1098 Pandas DataFrame. 1099 1100 For more information, see http://docs.insights.boosted.ai/universe-upload. 1101 1102 Parameters 1103 ---------- 1104 apikey: str 1105 API key provided by Boosted. This key should be protected as a secret. 1106 model_id: str 1107 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1108 button next to your model's name in the Model Summary Page in Boosted 1109 Insights. 1110 date: datetime.date or YYYY-MM-DD string 1111 Date of the universe to retrieve. 1112 proxy: str 1113 Your organization may require the use of a proxy for access. 1114 The address of a HTTPS proxy in the format of <address>:<port>. 1115 Examples are "123.456.789:123" or "my.proxy.com:123". 1116 Do not prepend with "https://". 1117 disable_verify_ssl: bool 1118 Your networking setup may be behind a firewall which performs SSL 1119 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1120 to point to the location of a custom certificate bundle, or set this 1121 parameter to true to disable SSL verification as a workaround. 1122 1123 Returns 1124 ------- 1125 pandas.DataFrame 1126 Pandas DataFrame containing the universe members. If a date was 1127 provided, only ISIN, Country, and Currency are returned. If no date 1128 was provided, returns From, To, ISIN, Country, Currency. 1129 """ 1130 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1131 return client.getUniverse(model_id, date) 1132 1133 1134def updateUniverse( 1135 apikey, 1136 model_id, 1137 universe_df, 1138 date=datetime.date.today() + timedelta(1), 1139 proxy=None, 1140 disable_verify_ssl=False, 1141): 1142 """ 1143 Sets the universe members of a model. 1144 1145 Sets the members of the universe of a model. Universe members may only be 1146 set for future dates. 1147 1148 For more information, see http://docs.insights.boosted.ai/universe-upload. 1149 1150 Parameters 1151 ---------- 1152 apikey: str 1153 API key provided by Boosted. This key should be protected as a secret. 1154 model_id: str 1155 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1156 button next to your model's name in the Model Summary Page in Boosted 1157 Insights. 1158 universe_df: Pandas.DataFrame 1159 A Pandas.DataFrame with columns ISIN, Country, Currency. 1160 date: datetime.date or YYYY-MM-DD string 1161 Date of the universe to retrieve. 1162 proxy: str 1163 Your organization may require the use of a proxy for access. 1164 The address of a HTTPS proxy in the format of <address>:<port>. 1165 Examples are "123.456.789:123" or "my.proxy.com:123". 1166 Do not prepend with "https://". 1167 disable_verify_ssl: bool 1168 Your networking setup may be behind a firewall which performs SSL 1169 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1170 to point to the location of a custom certificate bundle, or set this 1171 parameter to true to disable SSL verification as a workaround. 1172 1173 Returns 1174 ------- 1175 str 1176 Any warnings, e.g. failure to map ISINs, are returned. 1177 """ 1178 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1179 return client.updateUniverse(model_id, universe_df, date) 1180 1181 1182def createUniverse( 1183 apikey: str, 1184 universe: Union[pd.DataFrame, str], 1185 name: str, 1186 description: Optional[str] = None, 1187 proxy=None, 1188 disable_verify_ssl=False, 1189) -> List[str]: 1190 """ 1191 Creates a new boosted security universe. 1192 1193 Columns in the universe (dataframe or csv file path) to identify the 1194 universe are isin and/or symbol, from, to, country, currency. 1195 1196 Note that either isin or symbol are required columns. 1197 1198 Rules for the universe data are identical to those on the web universe 1199 creation screen: 1200 - Make sure your CSV does not contain empty columns. 1201 - Date columns must be in YYYY-MM-DD format. 1202 - The "from" and "to" fields represent the date range for which a 1203 security will exist in the universe for. The keyword "PRESENT" can be used 1204 in place of the "to_date" field. If you wish to create a Live model, ensure that 1205 at least some securities have "PRESENT" as their "to_date" field. 1206 - If the "to_date" column is ommitted, securites will exist in the universe 1207 until "PRESENT" by default, if possible. 1208 - "from" will default to "the beginning of time" if unspecified, and 1209 "to" will default to "PRESENT" 1210 1211 - The keyword "ANY" can also be used in place of the country and currency 1212 fields. 1213 - Rows with "ANY" will select the optimal security based on other securities 1214 in the portfolio For Country and Currency, the prefix "P_" (i.e. "P_USA") 1215 means "preferred." The model will attempt to match the security to the 1216 preferred specification. 1217 - "country" and "currency" will default to "ANY" if the column was 1218 omitted. 1219 1220 Parameters 1221 ---------- 1222 apikey: str 1223 API key provided by Boosted. This key should be protected as a secret. 1224 universe: Union[Pandas.DataFrame, str] 1225 May be either a Pandas.DataFrame, or a path to a csv. 1226 name: str 1227 The name of the new universe. 1228 description: str 1229 Optional description of the new universe. 1230 proxy: str 1231 Your organization may require the use of a proxy for access. 1232 The address of a HTTPS proxy in the format of <address>:<port>. 1233 Examples are "123.456.789:123" or "my.proxy.com:123". 1234 Do not prepend with "https://". 1235 disable_verify_ssl: bool 1236 Your networking setup may be behind a firewall which performs SSL 1237 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1238 to point to the location of a custom certificate bundle, or set this 1239 parameter to true to disable SSL verification as a workaround. 1240 1241 Returns 1242 ------- 1243 List[str] 1244 List of any warnings, e.g. failure to map ISINs, are returned. Return 1245 empty list if no warnings are returned. 1246 """ 1247 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1248 description = "" if description is None else description 1249 return client.create_universe(universe, name, description) 1250 1251 1252def getAllocationsForDate( 1253 apikey, 1254 portfolio_id, 1255 date=datetime.date.today(), 1256 rollback_to_last_available_date=False, 1257 proxy=None, 1258 disable_verify_ssl=False, 1259): 1260 """ 1261 Get the allocations for a portfolio on a date. 1262 1263 Parameters 1264 ---------- 1265 apikey: str 1266 API key provided by Boosted. This key should be protected as a secret. 1267 portfolio_id: str 1268 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1269 date: datetime.date or YYYY-MM-DD string 1270 Date of the universe to retrieve. 1271 rollback_to_last_available_date: bool 1272 Whether or not to retrieve rankings for the most recent date if the current date 1273 is not a trade date. 1274 proxy: str 1275 Your organization may require the use of a proxy for access. 1276 The address of a HTTPS proxy in the format of <address>:<port>. 1277 Examples are "123.456.789:123" or "my.proxy.com:123". 1278 Do not prepend with "https://". 1279 disable_verify_ssl: bool 1280 Your networking setup may be behind a firewall which performs SSL 1281 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1282 to point to the location of a custom certificate bundle, or set this 1283 parameter to true to disable SSL verification as a workaround. 1284 1285 Returns 1286 ------- 1287 dict: 1288 Dictionary containing allocation information: 1289 model_id: str 1290 - Model id from accompanying portfolio 1291 date: str 1292 - Date string in yyyy/mm/dd format of date of the allocation data 1293 allocations: List of dict 1294 - List of allocation information 1295 allocation: float 1296 - Allocation of security 1297 allocation_delta: float 1298 - Difference in allocation compared to previous trade 1299 company_name: str 1300 - Security name 1301 country: str 1302 - Security exchange region 1303 currency: str 1304 - Security currency 1305 has_trade_signal: bool 1306 - If trade was based on signal or outside reason 1307 isin: str 1308 - ISIN of security 1309 price: float 1310 - Price of security 1311 shares_owned: float 1312 - Current shares of the security 1313 shares_traded: float 1314 - Number of share traded of te security 1315 symbol: str 1316 - Symbol of the security 1317 """ 1318 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1319 return client.getAllocationsForDate(portfolio_id, date, rollback_to_last_available_date) 1320 1321 1322def getAllocationsForDateV2( 1323 apikey, 1324 portfolio_id, 1325 date=datetime.date.today(), 1326 rollback_to_last_available_date=False, 1327 proxy=None, 1328 disable_verify_ssl=False, 1329): 1330 """ 1331 Get the allocations for a portfolio on a date. 1332 1333 Parameters 1334 ---------- 1335 apikey: str 1336 API key provided by Boosted. This key should be protected as a secret. 1337 portfolio_id: str 1338 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1339 date: datetime.date or YYYY-MM-DD string 1340 Date of the universe to retrieve. 1341 rollback_to_last_available_date: bool 1342 Whether or not to retrieve rankings for the most recent date if the current date 1343 is not a trade date. 1344 proxy: str 1345 Your organization may require the use of a proxy for access. 1346 The address of a HTTPS proxy in the format of <address>:<port>. 1347 Examples are "123.456.789:123" or "my.proxy.com:123". 1348 Do not prepend with "https://". 1349 disable_verify_ssl: bool 1350 Your networking setup may be behind a firewall which performs SSL 1351 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1352 to point to the location of a custom certificate bundle, or set this 1353 parameter to true to disable SSL verification as a workaround. 1354 1355 Returns 1356 ------- 1357 dict: 1358 Dictionary containing allocation information: 1359 model_id: str 1360 - Model id from accompanying portfolio 1361 date: str 1362 - Date string in yyyy/mm/dd format of date of the allocation data 1363 allocations: List of dict 1364 - List of allocation information 1365 allocation: float 1366 - Allocation of security 1367 allocation_delta: float 1368 - Difference in allocation compared to previous allocation 1369 company_name: str 1370 - Security name 1371 country: str 1372 - Security exchange region 1373 currency: str 1374 - Security currency 1375 has_trade_signal: bool 1376 - If trade was based on signal or outside reason 1377 isin: str 1378 - ISIN of security 1379 price: float 1380 - Price of security 1381 shares_owned: float 1382 - Current shares of the security 1383 shares_traded: float 1384 - Number of shares traded of te security 1385 symbol: str 1386 - Symbol of the security 1387 """ 1388 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1389 return client.getAllocationsForDateV2(portfolio_id, date, rollback_to_last_available_date) 1390 1391 1392def getAllocationsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1393 """ 1394 Get the allocations for a portfolio on all dates. 1395 1396 Parameters 1397 ---------- 1398 apikey: str 1399 API key provided by Boosted. This key should be protected as a secret. 1400 portfolio_id: str 1401 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1402 proxy: str 1403 Your organization may require the use of a proxy for access. 1404 The address of a HTTPS proxy in the format of <address>:<port>. 1405 Examples are "123.456.789:123" or "my.proxy.com:123". 1406 Do not prepend with "https://". 1407 disable_verify_ssl: bool 1408 Your networking setup may be behind a firewall which performs SSL 1409 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1410 to point to the location of a custom certificate bundle, or set this 1411 parameter to true to disable SSL verification as a workaround. 1412 1413 Returns 1414 ------- 1415 dict: 1416 Dictionary containing allocation information. 1417 model_id: str 1418 - Model id from accompanying portfolio 1419 allocations: dict 1420 keys: date of the allocations in the value 1421 value: list of dict 1422 - List of allocation information 1423 allocation: float 1424 - Allocation of security 1425 allocation_delta: float 1426 - Difference in allocation compared to previous trade 1427 company_name: str 1428 - Security name 1429 country: str 1430 - Security exchange region 1431 currency: str 1432 - Security currency 1433 has_trade_signal: bool 1434 - If trade was based on signal or outside reason 1435 isin: str 1436 - ISIN of security 1437 price: float 1438 - Price of security 1439 shares_owned: float 1440 - Current shares of the security 1441 shares_traded: float 1442 - Number of share traded of te security 1443 symbol: str 1444 - Symbol of the security 1445 """ 1446 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1447 return client.getAllocationsByDates(portfolio_id) 1448 1449 1450def getSignalsForDate( 1451 apikey, 1452 portfolio_id, 1453 date=datetime.date.today(), 1454 rollback_to_last_available_date=False, 1455 proxy=None, 1456 disable_verify_ssl=False, 1457): 1458 """ 1459 Get the signals for a portfolio on a date. 1460 1461 Parameters 1462 ---------- 1463 apikey: str 1464 API key provided by Boosted. This key should be protected as a secret. 1465 portfolio_id: str 1466 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1467 date: datetime.date or YYYY-MM-DD string 1468 Date of the universe to retrieve. 1469 rollback_to_last_available_date: bool 1470 Whether or not to retrieve rankings for the most recent date if the current date 1471 is not a trade date. 1472 proxy: str 1473 Your organization may require the use of a proxy for access. 1474 The address of a HTTPS proxy in the format of <address>:<port>. 1475 Examples are "123.456.789:123" or "my.proxy.com:123". 1476 Do not prepend with "https://". 1477 disable_verify_ssl: bool 1478 Your networking setup may be behind a firewall which performs SSL 1479 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1480 to point to the location of a custom certificate bundle, or set this 1481 parameter to true to disable SSL verification as a workaround. 1482 1483 Returns 1484 ------- 1485 dict: 1486 Dictionary containing signals information: 1487 date: str 1488 - Date string in YYYY-MM-DD format of date of the signal data 1489 signals: List of dict 1490 - List of signal information per model 1491 model_id: str 1492 - Model id from accompanying portfolio 1493 signals_info: List of dict 1494 - Signal information for each security per model id 1495 company_name: str 1496 - Security name 1497 country: str 1498 - Security exchange region 1499 currency: str 1500 - Security currency 1501 date: str 1502 - Date of the signal data 1503 isin: str 1504 - ISIN of security 1505 signal: float 1506 - Signal from model 1507 signal_delta: float 1508 - Change in signal compared to last trade 1509 symbol: str 1510 - Symbol of the security 1511 """ 1512 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1513 return client.getSignalsForDate(portfolio_id, date, rollback_to_last_available_date) 1514 1515 1516def getSignalsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1517 """ 1518 Get the signals for all dates in the portfolio. 1519 1520 Parameters 1521 ---------- 1522 apikey: str 1523 API key provided by Boosted. This key should be protected as a secret. 1524 portfolio_id: str 1525 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1526 proxy: str 1527 Your organization may require the use of a proxy for access. 1528 The address of a HTTPS proxy in the format of <address>:<port>. 1529 Examples are "123.456.789:123" or "my.proxy.com:123". 1530 Do not prepend with "https://". 1531 disable_verify_ssl: bool 1532 Your networking setup may be behind a firewall which performs SSL 1533 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1534 to point to the location of a custom certificate bundle, or set this 1535 parameter to true to disable SSL verification as a workaround. 1536 1537 Returns 1538 ------- 1539 dict: 1540 Dictionary containing signals information: 1541 model_id: str 1542 - Model id from accompanying portfolio 1543 signals: dict 1544 keys: date of the signals in the value 1545 value: list of dict 1546 - List of signal information per model 1547 signals_info: List of dict 1548 - Signal information for each security per model id 1549 company_name: str 1550 - Security name 1551 country: str 1552 - Security exchange region 1553 currency: str 1554 - Security currency 1555 date: str 1556 - Date string in YYYY-MM-DD format of date requested 1557 isin: str 1558 - ISIN of security 1559 signal: float 1560 - Signal from model 1561 signal_delta: float 1562 - Change in signal compared to last trade 1563 symbol: str 1564 - Symbol of the security 1565 """ 1566 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1567 return client.getSignalsForAllDates(portfolio_id) 1568 1569 1570def getHistoricalTradeDates( 1571 apikey, portfolio_id, start_date=None, end_date=None, proxy=None, disable_verify_ssl=False 1572): 1573 """ 1574 Get the historical dates for which there exist trading data. 1575 1576 Parameters 1577 ---------- 1578 apikey: str 1579 API key provided by Boosted. This key should be protected as a secret. 1580 portfolio_id: str 1581 Portfolio ID. Portfolio IDs can be retrieved by clicking on the copy to clipboard 1582 button next to your portfolio's name in the Tear Sheet Page of a Model. 1583 start_date: datetime.date or YYYY-MM-DD string 1584 Starting date for the inclusive interval of dates to search. 1585 Defaults to 1 year prior to end date if unspecified. 1586 end_date: datetime.date or YYYY-MM-DD string 1587 Ending date for the inclusive interval of dates to search. 1588 Defaults to today if unspecified. 1589 proxy: str 1590 Your organization may require the use of a proxy for access. 1591 The address of a HTTPS proxy in the format of <address>:<port>. 1592 Examples are "123.456.789:123" or "my.proxy.com:123". 1593 Do not prepend with "https://". 1594 disable_verify_ssl: bool 1595 Your networking setup may be behind a firewall which performs SSL 1596 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1597 to point to the location of a custom certificate bundle, or set this 1598 parameter to true to disable SSL verification as a workaround. 1599 1600 Returns 1601 ------- 1602 dict: 1603 Dictionary containing date information 1604 dates: List of str 1605 List of historical trade dates in YYYY-MM-DD format. 1606 """ 1607 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1608 return client.getHistoricalTradeDates(portfolio_id, start_date, end_date) 1609 1610 1611def getRankingsForDate( 1612 apikey, 1613 portfolio_id, 1614 date=datetime.date.today(), 1615 rollback_to_last_available_date=False, 1616 proxy=None, 1617 disable_verify_ssl=False, 1618): 1619 """ 1620 Get the rankings data for a portfolio on a date. 1621 1622 Parameters 1623 ---------- 1624 apikey: str 1625 API key provided by Boosted. This key should be protected as a secret. 1626 portfolio_id: str 1627 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1628 date: datetime.date or YYYY-MM-DD string 1629 Date of the universe to retrieve. 1630 rollback_to_last_available_date: bool 1631 Whether or not to retrieve rankings for the most recent date if the current date 1632 is not a trade date. 1633 proxy: str 1634 Your organization may require the use of a proxy for access. 1635 The address of a HTTPS proxy in the format of <address>:<port>. 1636 Examples are "123.456.789:123" or "my.proxy.com:123". 1637 Do not prepend with "https://". 1638 disable_verify_ssl: bool 1639 Your networking setup may be behind a firewall which performs SSL 1640 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1641 to point to the location of a custom certificate bundle, or set this 1642 parameter to true to disable SSL verification as a workaround. 1643 1644 Returns 1645 ------- 1646 Dictionary containing rankings information: 1647 model_id: str 1648 - Model id that the portfolio belongs to 1649 date: str 1650 - Date string in yyyy/mm/dd format of date of the ranking data 1651 rankings: List of dict 1652 - Rankings info per security in the portfolio 1653 symbol: str 1654 - Symbol of the security 1655 isin: str 1656 - The International Securities Identification Number of the security 1657 country: str 1658 - Three character country code 1659 currency: str 1660 - The currency short length code 1661 rank: int 1662 - the ranking from 1 (top) 1663 companyName: str 1664 - The name of the company who owns the security 1665 delta: int 1666 - The change in ranking from the last data point, first will be null 1667 """ 1668 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1669 return client.getRankingsForDate(portfolio_id, date, rollback_to_last_available_date) 1670 1671 1672def getRankingsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1673 """ 1674 Get all rankings data for a portfolio. 1675 1676 Parameters 1677 ---------- 1678 apikey: str 1679 API key provided by Boosted. This key should be protected as a secret. 1680 portfolio_id: str 1681 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1682 proxy: str 1683 Your organization may require the use of a proxy for access. 1684 The address of a HTTPS proxy in the format of <address>:<port>. 1685 Examples are "123.456.789:123" or "my.proxy.com:123". 1686 Do not prepend with "https://". 1687 disable_verify_ssl: bool 1688 Your networking setup may be behind a firewall which performs SSL 1689 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1690 to point to the location of a custom certificate bundle, or set this 1691 parameter to true to disable SSL verification as a workaround. 1692 1693 Returns 1694 ------- 1695 Dictionary containing rankings information: 1696 model_id: str 1697 - Model id that the portfolio belongs to 1698 rankings: dict 1699 keys: dates requested in yyyy/mm/dd format, model_id 1700 value: list of dict 1701 - Rankings info per security in the portfolio 1702 symbol: str 1703 - Symbol of the security 1704 isin: str 1705 - The International Securities Identification Number of the security 1706 country: str 1707 - Three character country code 1708 currency: str 1709 - The currency short length code 1710 rank: int 1711 - the ranking from 1 (top) 1712 companyName: str 1713 - The name of the company who owns the security 1714 delta: int 1715 - The change in ranking from the last data point, first will be null 1716 """ 1717 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1718 return client.getRankingsForAllDates(portfolio_id) 1719 1720 1721def createSignalsModel( 1722 apikey, upload_data, model_name="SignalsUploadModel", proxy=None, disable_verify_ssl=False 1723): 1724 """ 1725 Create a new model with uploaded signals. The model may take a while to 1726 process asynchronously after this method returns. 1727 1728 Parameters 1729 ---------- 1730 apikey: str 1731 API key provided by Boosted. This key should be protected as a secret. 1732 upload_data: pandas.DataFrame 1733 Pandas DataFrame containing your data. The index must be 1734 DatetimeIndex. The first columns must be ISIN, Country, Currency by 1735 default. The remaining column must be the weight. 1736 model_name: str 1737 Name for this model. 1738 proxy: str 1739 Your organization may require the use of a proxy for access. 1740 The address of a HTTPS proxy in the format of <address>:<port>. 1741 Examples are "123.456.789:123" or "my.proxy.com:123". 1742 Do not prepend with "https://". 1743 disable_verify_ssl: bool 1744 Your networking setup may be behind a firewall which performs SSL 1745 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1746 to point to the location of a custom certificate bundle, or set this 1747 parameter to true to disable SSL verification as a workaround. 1748 1749 Returns 1750 ------- 1751 2-tuple 1752 str 1753 Model ID of the newly created model with uploaded signals. 1754 list of str 1755 Warnings incurred while uploading the allocations data. 1756 """ 1757 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1758 return client.createSignalsModel(upload_data, model_name) 1759 1760 1761def addSignalsToUploadedModel( 1762 apikey, 1763 model_id, 1764 upload_data, 1765 proxy=None, 1766 disable_verify_ssl=False, 1767 recalc_all=False, 1768 recalc_portfolio_ids=None, 1769): 1770 """ 1771 Add allocations to a previously created uploaded model, then update the most recently accessed 1772 portfolio in the model, or update based on the recalc_all/recalc_portfolio_ids parameters. 1773 The model may take a while to process asynchronously after this method returns. 1774 1775 Parameters 1776 ---------- 1777 apikey: str 1778 API key provided by Boosted. This key should be protected as a secret. 1779 model_id: str 1780 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1781 button next to your model's name in the Model Summary Page in Boosted 1782 Insights. 1783 upload_data: pandas.DataFrame 1784 Pandas DataFrame containing your data. The index must be 1785 DatetimeIndex. The first columns must be ISIN, Country, Currency by 1786 default. The remaining column must be the weight. 1787 proxy: str 1788 Your organization may require the use of a proxy for access. 1789 The address of a HTTPS proxy in the format of <address>:<port>. 1790 Examples are "123.456.789:123" or "my.proxy.com:123". 1791 Do not prepend with "https://". 1792 disable_verify_ssl: bool 1793 Your networking setup may be behind a firewall which performs SSL 1794 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1795 to point to the location of a custom certificate bundle, or set this 1796 parameter to true to disable SSL verification as a workaround. 1797 recalc_all: bool 1798 Set to True to recalculate all portfolios under the model after uploading the allocations. 1799 Otherwise if not set to True, the most recently-accessed portfolio in the model is updated, 1800 or if provided, the list of portfolios provided in recalc_portfolio_ids will be updated. 1801 recalc_portfolio_ids: List[str] 1802 Specify a list of portfolio IDs to recalculate after uploading the allocations. 1803 Portfolio IDs can be retrieved from portfolio's configuration page. 1804 1805 Returns 1806 ------- 1807 list of str 1808 Warnings incurred while uploading the allocations data. 1809 """ 1810 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1811 return client.addSignalsToUploadedModel( 1812 model_id, upload_data, recalc_all=recalc_all, recalc_portfolio_ids=recalc_portfolio_ids 1813 ) 1814 1815 1816def getSignalsFromUploadedModelForDate( 1817 apikey, model_id, date=datetime.date.today(), proxy=None, disable_verify_ssl=False 1818): 1819 """ 1820 Retrieve uploaded signal information for a uploaded model for one date. 1821 1822 Parameters 1823 ---------- 1824 apikey: str 1825 API key provided by Boosted. This key should be protected as a secret. 1826 model_id: str 1827 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1828 button next to your model's name in the Model Summary Page in Boosted 1829 Insights. 1830 date: datetime.date or YYYY-MM-DD string 1831 Date of the universe to retrieve. 1832 proxy: str 1833 Your organization may require the use of a proxy for access. 1834 The address of a HTTPS proxy in the format of <address>:<port>. 1835 Examples are "123.456.789:123" or "my.proxy.com:123". 1836 Do not prepend with "https://". 1837 disable_verify_ssl: bool 1838 Your networking setup may be behind a firewall which performs SSL 1839 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1840 to point to the location of a custom certificate bundle, or set this 1841 parameter to true to disable SSL verification as a workaround. 1842 1843 Returns 1844 ------- 1845 List of signal information 1846 date: str 1847 - Date string in yyyy/mm/dd format of date requested 1848 isin: str 1849 - The International Securities Identification Number of the security 1850 country: str 1851 - Three character country code 1852 currency: str 1853 - The currency short length code 1854 weight: float 1855 - signal value 1856 """ 1857 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1858 return client.getSignalsFromUploadedModel(model_id, date) 1859 1860 1861def getSignalsFromUploadedModelForAllDates(apikey, model_id, proxy=None, disable_verify_ssl=False): 1862 """ 1863 Retrieve uploaded signal information for a uploaded model for all dates. 1864 1865 Parameters 1866 ---------- 1867 apikey: str 1868 API key provided by Boosted. This key should be protected as a secret. 1869 model_id: str 1870 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1871 button next to your model's name in the Model Summary Page in Boosted 1872 Insights. 1873 proxy: str 1874 Your organization may require the use of a proxy for access. 1875 The address of a HTTPS proxy in the format of <address>:<port>. 1876 Examples are "123.456.789:123" or "my.proxy.com:123". 1877 Do not prepend with "https://". 1878 disable_verify_ssl: bool 1879 Your networking setup may be behind a firewall which performs SSL 1880 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1881 to point to the location of a custom certificate bundle, or set this 1882 parameter to true to disable SSL verification as a workaround. 1883 1884 Returns 1885 ------- 1886 List of signal information 1887 date: str 1888 - Date string in yyyy/mm/dd format of date requested 1889 isin: str 1890 - The International Securities Identification Number of the security 1891 country: str 1892 - Three character country code 1893 currency: str 1894 - The currency short length code 1895 weight: float 1896 - signal value 1897 """ 1898 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1899 return client.getSignalsFromUploadedModel(model_id) 1900 1901 1902def createPortfolioWithPortfolioSettings( 1903 apikey, 1904 model_id, 1905 portfolio_name, 1906 portfolio_description, 1907 portfolio_settings, 1908 proxy=None, 1909 disable_verify_ssl=False, 1910): 1911 """ 1912 Create a portfolio for a model, based on provided portfolio settings. 1913 Specific portfolio settings will fall back to defaults if not provided, and 1914 no two portfolios on the same model may have the exact same set of settings. 1915 Unspecified portfolio settings keys will be defaulted to their model default values. 1916 The portfolio will be asynchronously processed/recalculated and will be available within 1917 5-10 minutes. 1918 1919 Parameters 1920 ---------- 1921 apikey: str 1922 API key provided by Boosted. This key should be protected as a secret. 1923 model_id: str 1924 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1925 button next to your model's name in the Model Summary Page in Boosted 1926 Insights. 1927 portfolio_name: str 1928 Name of the new portfolio. Must be <= 20 characters. 1929 portfolio_description: str 1930 Description for the new portfolio. Must be <= 100 characters. 1931 portfolio_settings: boosted.api.api_type.PortfolioSettings 1932 A pre-configured PortfolioSettings dict. 1933 proxy: str 1934 Your organization may require the use of a proxy for access. 1935 The address of a HTTPS proxy in the format of <address>:<port>. 1936 Examples are "123.456.789:123" or "my.proxy.com:123". 1937 Do not prepend with "https://". 1938 disable_verify_ssl: bool 1939 Your networking setup may be behind a firewall which performs SSL 1940 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1941 to point to the location of a custom certificate bundle, or set this 1942 parameter to true to disable SSL verification as a workaround. 1943 1944 Returns 1945 ------- 1946 str 1947 Portfolio ID of the newly created portfolio. 1948 """ 1949 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1950 return client.createPortfolioWithPortfolioSettings( 1951 model_id, portfolio_name, portfolio_description, portfolio_settings 1952 ) 1953 1954 1955def getPortfolioSettings(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1956 """ 1957 Retrieve portfolio settings from an existing portfolio. The result can be modified and 1958 reused to create a new portfolio. The set of returned portfolio settings are limited 1959 to a view of ones editable as documented in `boosted.api.api_type.PortfolioSettings` only. 1960 1961 Parameters 1962 ---------- 1963 apikey: str 1964 API key provided by Boosted. This key should be protected as a secret. 1965 portfolio_id: str 1966 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1967 proxy: str 1968 Your organization may require the use of a proxy for access. 1969 The address of a HTTPS proxy in the format of <address>:<port>. 1970 Examples are "123.456.789:123" or "my.proxy.com:123". 1971 Do not prepend with "https://". 1972 disable_verify_ssl: bool 1973 Your networking setup may be behind a firewall which performs SSL 1974 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1975 to point to the location of a custom certificate bundle, or set this 1976 parameter to true to disable SSL verification as a workaround. 1977 1978 Returns 1979 ------- 1980 boosted.api.api_type.PortfolioSettings 1981 A PortfolioSettings can be used to create a new portfolio. 1982 """ 1983 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1984 return client.getPortfolioSettings(portfolio_id) 1985 1986 1987def getGbiIdFromIsinCountryCurrencyDate( 1988 apikey, isin_country_currency_dates, proxy=None, disable_verify_ssl=False 1989): 1990 """ 1991 Get the gbi securities from a isin, country, currency, date combinations 1992 1993 Parameters 1994 ---------- 1995 apikey: str 1996 API key provided by Boosted. This key should be protected as a secret. 1997 isin_country_currency_dates: list of IsinCountryCurrencyDate 1998 An array of IsinCountryCurrencyDate 1999 proxy: str 2000 Your organization may require the use of a proxy for access. 2001 The address of a HTTPS proxy in the format of <address>:<port>. 2002 Examples are "123.456.789:123" or "my.proxy.com:123". 2003 Do not prepend with "https://". 2004 disable_verify_ssl: bool 2005 Your networking setup may be behind a firewall which performs SSL 2006 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2007 to point to the location of a custom certificate bundle, or set this 2008 parameter to true to disable SSL verification as a workaround. 2009 2010 Returns 2011 ------- 2012 list of GbiIdSecurity 2013 The corresponding gbi id securities 2014 """ 2015 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2016 return client.getGbiIdFromIsinCountryCurrencyDate(isin_country_currency_dates) 2017 2018 2019def getDatasetDates(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 2020 """ 2021 Gets the valid to and valid from dates of the given dataset id 2022 2023 Parameters 2024 ---------- 2025 apikey: str 2026 API key provided by Boosted. This key should be protected as a secret. 2027 dataset_id: str 2028 Dataset ID. Can be from the output of addDependentDataset or be found 2029 in your Custom Data listing in Boosted Insights. 2030 proxy: str 2031 Your organization may require the use of a proxy for access. 2032 The address of a HTTPS proxy in the format of <address>:<port>. 2033 Examples are "123.456.789:123" or "my.proxy.com:123". 2034 Do not prepend with "https://". 2035 disable_verify_ssl: bool 2036 Your networking setup may be behind a firewall which performs SSL 2037 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2038 to point to the location of a custom certificate bundle, or set this 2039 parameter to true to disable SSL verification as a workaround. 2040 2041 Returns 2042 ------- 2043 dict: 2044 Dictionary containing the valid to and from dates of the dataset 2045 { 2046 'validFrom': datetime.date, 2047 'validTo': datetime.date 2048 } 2049 ___ 2050 """ 2051 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2052 return client.getDatasetDates(dataset_id) 2053 2054 2055def getRankingAnalysis(apikey, model_id, date, proxy=None, disable_verify_ssl=False): 2056 """ 2057 Gets the ranking 2.0 analysis data for the given model on the given date 2058 2059 Parameters 2060 ---------- 2061 apikey: str 2062 API key provided by Boosted. This key should be protected as a secret. 2063 model_id: str 2064 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2065 button next to your model's name in the Model Summary Page in Boosted 2066 Insights. 2067 date: datetime.date or YYYY-MM-DD string 2068 Date of the data to retrieve. 2069 proxy: str 2070 Your organization may require the use of a proxy for access. 2071 The address of a HTTPS proxy in the format of <address>:<port>. 2072 Examples are "123.456.789:123" or "my.proxy.com:123". 2073 Do not prepend with "https://". 2074 disable_verify_ssl: bool 2075 Your networking setup may be behind a firewall which performs SSL 2076 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2077 to point to the location of a custom certificate bundle, or set this 2078 parameter to true to disable SSL verification as a workaround. 2079 2080 Returns 2081 ------- 2082 pandas.DataFrame 2083 Pandas DataFrame containing your data indexed by data buckets and feature names. 2084 ___ 2085 """ 2086 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2087 return client.getRankingAnalysis(model_id, date) 2088 2089 2090def getRankingExplain( 2091 apikey, 2092 model_id, 2093 date, 2094 proxy=None, 2095 disable_verify_ssl=False, 2096 index_by_symbol: bool = False, 2097 index_by_all_metadata: bool = False, 2098): 2099 """ 2100 Gets the ranking 2.0 explain data for the given model on the given date 2101 2102 Parameters 2103 ---------- 2104 apikey: str 2105 API key provided by Boosted. This key should be protected as a secret. 2106 model_id: str 2107 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2108 button next to your model's name in the Model Summary Page in Boosted 2109 Insights. 2110 date: datetime.date or YYYY-MM-DD string 2111 Date of the data to retrieve. 2112 proxy: str 2113 Your organization may require the use of a proxy for access. 2114 The address of a HTTPS proxy in the format of <address>:<port>. 2115 Examples are "123.456.789:123" or "my.proxy.com:123". 2116 Do not prepend with "https://". 2117 disable_verify_ssl: bool 2118 Your networking setup may be behind a firewall which performs SSL 2119 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2120 to point to the location of a custom certificate bundle, or set this 2121 parameter to true to disable SSL verification as a workaround. 2122 index_by_symbol: bool 2123 If true, index by stock symbol instead of ISIN. 2124 index_by_all_metadata: bool 2125 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2126 Overrides index_by_symbol. 2127 2128 Returns 2129 ------- 2130 pandas.DataFrame 2131 Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata 2132 and feature names. 2133 ___ 2134 """ 2135 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2136 return client.getRankingExplain( 2137 model_id, date, index_by_symbol=index_by_symbol, index_by_all_metadata=index_by_all_metadata 2138 ) 2139 2140 2141def getExplainForPortfolio( 2142 apikey, 2143 model_id, 2144 portfolio_id, 2145 date, 2146 proxy=None, 2147 disable_verify_ssl=False, 2148 index_by_symbol: bool = False, 2149 index_by_all_metadata: bool = False, 2150): 2151 """ 2152 Gets the ranking 2.0 explain data for the given model on the given date, 2153 filtered by portfolio. 2154 2155 Parameters 2156 ---------- 2157 apikey: str 2158 API key provided by Boosted. This key should be protected as a secret. 2159 model_id: str 2160 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2161 button next to your model's name in the Model Summary Page in Boosted 2162 Insights. 2163 portfolio_id: str 2164 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2165 date: datetime.date or YYYY-MM-DD string 2166 Date of the data to retrieve. 2167 proxy: str 2168 Your organization may require the use of a proxy for access. 2169 The address of a HTTPS proxy in the format of <address>:<port>. 2170 Examples are "123.456.789:123" or "my.proxy.com:123". 2171 Do not prepend with "https://". 2172 disable_verify_ssl: bool 2173 Your networking setup may be behind a firewall which performs SSL 2174 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2175 to point to the location of a custom certificate bundle, or set this 2176 parameter to true to disable SSL verification as a workaround. 2177 index_by_symbol: bool 2178 If true, index by stock symbol instead of ISIN. 2179 index_by_all_metadata: bool 2180 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2181 Overrides index_by_symbol. 2182 2183 Returns 2184 ------- 2185 pandas.DataFrame 2186 Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata 2187 and feature names, filtered by portfolio. 2188 ___ 2189 """ 2190 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2191 return client.getExplainForPortfolio( 2192 model_id, 2193 portfolio_id, 2194 date, 2195 index_by_symbol=index_by_symbol, 2196 index_by_all_metadata=index_by_all_metadata, 2197 ) 2198 2199 2200def getDenseSignalsForDate( 2201 apikey, 2202 portfolio_id, 2203 date=datetime.date.today(), 2204 rollback_to_last_available_date=False, 2205 proxy=None, 2206 disable_verify_ssl=False, 2207): 2208 """ 2209 Get the dense signals for a portfolio on a date. 2210 2211 Parameters 2212 ---------- 2213 apikey: str 2214 API key provided by Boosted. This key should be protected as a secret. 2215 portfolio_id: str 2216 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2217 date: datetime.date or YYYY-MM-DD string 2218 Date of the signals to retrieve. 2219 rollback_to_last_available_date: bool 2220 Whether or not to retrieve signals for the most recent date if the current date 2221 is not a trade date. 2222 proxy: str 2223 Your organization may require the use of a proxy for access. 2224 The address of a HTTPS proxy in the format of <address>:<port>. 2225 Examples are "123.456.789:123" or "my.proxy.com:123". 2226 Do not prepend with "https://". 2227 disable_verify_ssl: bool 2228 Your networking setup may be behind a firewall which performs SSL 2229 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2230 to point to the location of a custom certificate bundle, or set this 2231 parameter to true to disable SSL verification as a workaround. 2232 2233 Returns 2234 ------- 2235 dict: 2236 Dictionary containing signals information: 2237 date: str 2238 - Date string in YYYY-MM-DD format of date of the signal data 2239 signals: List of dict 2240 - List of signal information per model 2241 model_id: str 2242 - Model id from accompanying portfolio 2243 signals_info: List of dict 2244 - Signal information for each security per model id 2245 allocation: float 2246 - Allocation in the portfolio 2247 company_name: str 2248 - Security name 2249 country: str 2250 - Security exchange region 2251 currency: str 2252 - Security currency 2253 date: str 2254 - Date of the signal data 2255 isin: str 2256 - ISIN of security 2257 quantile: int 2258 - Quantile from 1 to 5 2259 scaled_signal: float 2260 - Scaled signal 2261 signal: float 2262 - Signal from model 2263 symbol: str 2264 - Symbol of the security 2265 """ 2266 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2267 return client.getDenseSignalsForDate(portfolio_id, date, rollback_to_last_available_date) 2268 2269 2270def getDenseSignals( 2271 apikey, 2272 model_id, 2273 portfolio_id, 2274 file_name=None, 2275 location="./", 2276 proxy=None, 2277 disable_verify_ssl=False, 2278): 2279 """ 2280 Downloads the dense signal csv for the provided portfolio and model 2281 2282 Parameters 2283 ---------- 2284 apikey: str 2285 API key provided by Boosted. This key should be protected as a secret. 2286 model_id: str 2287 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2288 button next to your model's name in the Model Summary Page in Boosted 2289 Insights. 2290 portfolio_id: str 2291 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2292 file_name: str 2293 File name of the dense signals file to save as. 2294 If no file name is given the file name will be "<model_id>-<portfolio_id>_dense_signals.csv" 2295 location: str 2296 The location to save the file to. 2297 If no location is given then it will be saved to the current directory. 2298 proxy: str 2299 Your organization may require the use of a proxy for access. 2300 The address of a HTTPS proxy in the format of <address>:<port>. 2301 Examples are "123.456.789:123" or "my.proxy.com:123". 2302 Do not prepend with "https://". 2303 disable_verify_ssl: bool 2304 Your networking setup may be behind a firewall which performs SSL 2305 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2306 to point to the location of a custom certificate bundle, or set this 2307 parameter to true to disable SSL verification as a workaround. 2308 2309 Returns 2310 ------- 2311 None 2312 ___ 2313 """ 2314 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2315 return client.getDenseSignals(model_id, portfolio_id, file_name, location) 2316 2317 2318def getRanking2DateAnalysisFile( 2319 apikey, 2320 model_id, 2321 portfolio_id, 2322 date, 2323 file_name=None, 2324 location="./", 2325 proxy=None, 2326 disable_verify_ssl=False, 2327): 2328 """ 2329 Downloads the ranking analysis file for the provied portfolio and model. 2330 If no file exist then it will send a request to generate the file and continuously 2331 poll the server every 5 seconds to try and download the file until the file is downloaded. 2332 2333 Parameters 2334 ---------- 2335 apikey: str 2336 API key provided by Boosted. This key should be protected as a secret. 2337 model_id: str 2338 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2339 button next to your model's name in the Model Summary Page in Boosted 2340 Insights. 2341 portfolio_id: str 2342 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2343 date: datetime.date or YYYY-MM-DD string 2344 Date of the data to retrieve. 2345 file_name: str 2346 File name of the dense signals file to save as. 2347 If no file name is given the file name will be 2348 "<model_id>-<portfolio_id>_statistical_analysis_<date>.xlsx" 2349 location: str 2350 The location to save the file to. 2351 If no location is given then it will be saved to the current directory. 2352 proxy: str 2353 Your organization may require the use of a proxy for access. 2354 The address of a HTTPS proxy in the format of <address>:<port>. 2355 Examples are "123.456.789:123" or "my.proxy.com:123". 2356 Do not prepend with "https://". 2357 disable_verify_ssl: bool 2358 Your networking setup may be behind a firewall which performs SSL 2359 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2360 to point to the location of a custom certificate bundle, or set this 2361 parameter to true to disable SSL verification as a workaround. 2362 2363 Returns 2364 ------- 2365 None 2366 ___ 2367 """ 2368 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2369 return client.getRanking2DateAnalysisFile(model_id, portfolio_id, date, file_name, location) 2370 2371 2372def getRanking2DateExplainFile( 2373 apikey, 2374 model_id, 2375 portfolio_id, 2376 date, 2377 file_name=None, 2378 location="./", 2379 proxy=None, 2380 disable_verify_ssl=False, 2381 overwrite: bool = False, 2382 index_by_all_metadata: bool = False, 2383): 2384 """ 2385 Downloads the ranking explain file for the provided portfolio and model. 2386 If no file exist then it will send a request to generate the file and continuously 2387 poll the server every 5 seconds to try and download the file until the file is downloaded. 2388 2389 Parameters 2390 ---------- 2391 apikey: str 2392 API key provided by Boosted. This key should be protected as a secret. 2393 model_id: str 2394 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2395 button next to your model's name in the Model Summary Page in Boosted 2396 Insights. 2397 portfolio_id: str 2398 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2399 date: datetime.date or YYYY-MM-DD string 2400 Date of the data to retrieve. 2401 file_name: str 2402 File name of the dense signals file to save as. 2403 If no file name is given the file name will be 2404 "<model_id>-<portfolio_id>_explain_data_<date>.xlsx" 2405 location: str 2406 The location to save the file to. 2407 If no location is given then it will be saved to the current directory. 2408 proxy: str 2409 Your organization may require the use of a proxy for access. 2410 The address of a HTTPS proxy in the format of <address>:<port>. 2411 Examples are "123.456.789:123" or "my.proxy.com:123". 2412 Do not prepend with "https://". 2413 disable_verify_ssl: bool 2414 Your networking setup may be behind a firewall which performs SSL 2415 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2416 to point to the location of a custom certificate bundle, or set this 2417 parameter to true to disable SSL verification as a workaround. 2418 overwrite: bool 2419 Defaults to False, set to True to regenerate the file. 2420 index_by_all_metadata: bool 2421 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2422 2423 2424 Returns 2425 ------- 2426 None 2427 ___ 2428 """ 2429 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2430 return client.getRanking2DateExplainFile( 2431 model_id, 2432 portfolio_id, 2433 date, 2434 file_name, 2435 location, 2436 overwrite, 2437 index_by_all_metadata, 2438 ) 2439 2440 2441def getRanking2DateExplain( 2442 apikey: str, 2443 model_id: str, 2444 portfolio_id: str, 2445 date: BoostedDate, 2446 overwrite: bool = False, 2447 proxy: Optional[str] = None, 2448 disable_verify_ssl: bool = False, 2449) -> Dict[str, pd.DataFrame]: 2450 """ 2451 Downloads the ranking explain file for the provied portfolio and model and 2452 loads it into a dict of pandas dataframes. If no file exists then it will 2453 send a request to generate the file and continuously poll the server every 5 2454 seconds to try and download the file until the file is downlodded. 2455 2456 Parameters 2457 ---------- 2458 apikey: str 2459 API key provided by Boosted. This key should be protected as a secret. 2460 model_id: str 2461 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2462 button next to your model's name in the Model Summary Page in Boosted 2463 Insights. 2464 portfolio_id: str 2465 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2466 date: datetime.date or YYYY-MM-DD string 2467 Date of the data to retrieve. 2468 overwrite: bool 2469 Defaults to False, set to True to regenerate the file. 2470 proxy: str 2471 Your organization may require the use of a proxy for access. 2472 The address of a HTTPS proxy in the format of <address>:<port>. 2473 Examples are "123.456.789:123" or "my.proxy.com:123". 2474 Do not prepend with "https://". 2475 disable_verify_ssl: bool 2476 Your networking setup may be behind a firewall which performs SSL 2477 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2478 to point to the location of a custom certificate bundle, or set this 2479 parameter to true to disable SSL verification as a workaround. 2480 2481 Returns 2482 ------- 2483 A dict with excel sheet names as keys, and Pandas dataframe, indexed by 2484 symbol, as values. 2485 ___ 2486 """ 2487 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2488 return client.getRanking2DateExplain(model_id, portfolio_id, convert_date(date), overwrite) 2489 2490 2491def getTearSheet( 2492 apikey, 2493 model_id, 2494 portfolio_id, 2495 proxy=None, 2496 disable_verify_ssl=False, 2497 start_date=None, 2498 end_date=None, 2499 block=False, 2500): 2501 """ 2502 Gets the model and portfolio's tear sheet and returns it as a list of tear sheet groups 2503 2504 Parameters 2505 ---------- 2506 apikey: str 2507 API key provided by Boosted. This key should be protected as a secret. 2508 model_id: str 2509 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2510 button next to your model's name in the Model Summary Page in Boosted 2511 Insights. 2512 portfolio_id: str 2513 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2514 start_date: str or None 2515 Start date for the range of data represented by the tear sheet (YYYY-MM-DD) 2516 end_date: str or None 2517 End date for the range of data represented by the tear sheet (YYYY-MM-DD) 2518 Must be None if and only if start_date is None 2519 block: bool 2520 Whether or not to wait for the data to be ready. No effect if dates are not 2521 provided 2522 Returns 2523 ------- 2524 List 2525 Each element in the list represents a group in the tearsheet. i.e Risk Adjusted Returns 2526 Each dictionary is made of member which is a list of dicts representing a tearsheet 2527 value and a group name which is the name of the group shown on screen. Each dict in 2528 the member array has value which is a floating point number, type which is either 2529 "number" or "precent" to determine if value is a raw number or a percentage value, 2530 and finally "name" which is the name shown on screen. 2531 [ 2532 { 2533 members: [ 2534 { 2535 "value": float, 2536 "type": str, 2537 "name": str 2538 }, 2539 ], 2540 group_name: str 2541 }, 2542 ] 2543 ___ 2544 """ 2545 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2546 return client.getTearSheet( 2547 model_id, portfolio_id, start_date=start_date, end_date=end_date, block=block 2548 ) 2549 2550 2551def getPortfolioStatus( 2552 apikey, 2553 model_id, 2554 portfolio_id, 2555 job_date, 2556 proxy=None, 2557 disable_verify_ssl=False, 2558): 2559 """ 2560 Gets the update status of a portfolio 2561 2562 Parameters 2563 ---------- 2564 model_id: str 2565 The id of the model the portfolio belongs to 2566 portfolio_id: str 2567 The id of the portfolio 2568 job_date: str 2569 The date in question, in YYYY-MM-DD format 2570 Returns 2571 ------- 2572 dict with properties 2573 is_complete: bool 2574 True if the calculation for the date has been completed 2575 last_update: str 2576 The most recent date with a completed calculation 2577 next_update: str 2578 The earliest date (in the future) with an incomplete calculation 2579 ___ 2580 """ 2581 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2582 return client.getPortfolioStatus(model_id, portfolio_id, job_date) 2583 2584 2585def getBlacklist( 2586 apikey, 2587 blacklist_id, 2588 proxy=None, 2589 disable_verify_ssl=False, 2590): 2591 """ 2592 Gets blacklist with provided id. You must have access to the blacklist. 2593 2594 Parameters 2595 ---------- 2596 blacklist_id: int 2597 Blacklist ID. Blacklist ID can be found by running getBlacklists, or 2598 when you create a blacklist the ID of the created blacklist will be shown. 2599 2600 Returns 2601 ------- 2602 Blacklist 2603 ___ 2604 """ 2605 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2606 return client.getBlacklist(blacklist_id) 2607 2608 2609def getBlacklists( 2610 apikey, 2611 model_id=None, 2612 company_id=None, 2613 last_N=None, 2614 proxy=None, 2615 disable_verify_ssl=False, 2616): 2617 """ 2618 Gets the list of blacklists with provided company_id or model_id. If last_N is provided, 2619 the list will return N most recently created blacklists. If no parameter is provided, 2620 the list of user company's blacklists will be returned. 2621 Note that when company_id is provided, blacklists will be returned if you have access 2622 to their model, if they are model specified. 2623 company_id and model_id cannot both be provided. 2624 2625 Parameters 2626 ---------- 2627 model_id: str 2628 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2629 button next to your model's name in the Model Summary Page in Boosted 2630 Insights. You must have access to the model. 2631 company_id: str 2632 Company ID. Used by administrators to access blacklists from the given company. 2633 last_N: int 2634 N most recently created blacklists to return 2635 2636 Returns 2637 ------- 2638 list of Blacklists 2639 ___ 2640 """ 2641 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2642 return client.getBlacklists(model_id=model_id, company_id=company_id, last_N=last_N) 2643 2644 2645def createBlacklist( 2646 apikey, 2647 isin, 2648 long_short=2, 2649 start_date=datetime.date.today(), 2650 end_date="4000-01-01", 2651 model_id=None, 2652 proxy=None, 2653 disable_verify_ssl=False, 2654): 2655 """ 2656 Creates a blacklist with ISIN, long_short, start_date and end_date. If model_id is given, 2657 the blacklist will be set for the given model. long_short will default to 2, 2658 start_date will default to today, and end_date will default to 4000-01-01, 2659 unless they are provided. 2660 2661 Parameters 2662 ---------- 2663 isin: string 2664 ISIN of the blacklist to be created 2665 long_short: int 2666 -1: short blacklist only 1: long blacklist only 2: both 2667 start_date: string 2668 The created blacklist will take effect from start_date. 2669 end_date: string 2670 The created blacklist will take effect until end_date. 2671 model_id: str 2672 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2673 button next to your model's name in the Model Summary Page in Boosted 2674 Insights. You must have access to the model. 2675 2676 Returns 2677 ------- 2678 Blacklist 2679 ___ 2680 """ 2681 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2682 return client.createBlacklist( 2683 isin, long_short=long_short, start_date=start_date, end_date=end_date, model_id=model_id 2684 ) 2685 2686 2687def createBlacklistsFromCSV(apikey, csv_name, proxy=None, disable_verify_ssl=False): 2688 """ 2689 Creates blacklists from a csv. CSV must have the following header: 2690 ModelID, ISIN, LongShort, StartDate, EndDate 2691 where StartDate and EndDate are in the form of YYYY-MM-DD 2692 For more information and default behaviours, please refer to createBlacklist. 2693 2694 Parameters 2695 ---------- 2696 csv_name: string 2697 Name of the csv containing blacklists. Csv must be located in the same directory. 2698 2699 Returns 2700 ------- 2701 Blacklists 2702 ___ 2703 """ 2704 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2705 return client.createBlacklistsFromCSV(csv_name) 2706 2707 2708def updateBlacklist( 2709 apikey, 2710 blacklist_id, 2711 long_short=None, 2712 start_date=None, 2713 end_date=None, 2714 proxy=None, 2715 disable_verify_ssl=False, 2716): 2717 """ 2718 Updates the blacklist with given id. You must have access to the blacklist. 2719 long_short, start_date and end_date are all optional. 2720 2721 Parameters 2722 ---------- 2723 blacklist_id: int 2724 Blacklist ID. Blacklist ID can be found by running getBlacklists, 2725 or when you create a blacklist the ID of the created blacklist will be shown. 2726 long_short: int 2727 -1: short blacklist only 1: long blacklist only 2: both 2728 start_date: string 2729 The created blacklist will take effect from start_date. 2730 end_date: string 2731 The created blacklist will take effect until end_date. 2732 2733 Returns 2734 ------- 2735 Blacklist 2736 ___ 2737 """ 2738 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2739 return client.updateBlacklist( 2740 blacklist_id, long_short=long_short, start_date=start_date, end_date=end_date 2741 ) 2742 2743 2744def deleteBlacklist( 2745 apikey, 2746 blacklist_id, 2747 proxy=None, 2748 disable_verify_ssl=False, 2749): 2750 """ 2751 Deletes the blacklist with given id. You must have access to the blacklist. 2752 2753 Parameters 2754 ---------- 2755 blacklist_id: int 2756 Blacklist ID. Blacklist ID can be found by running getBlacklists, 2757 or when you create a blacklist the ID of the created blacklist will be shown. 2758 2759 Returns 2760 ------- 2761 Boolean, denoting the success of deletion 2762 ___ 2763 """ 2764 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2765 return client.deleteBlacklist(blacklist_id) 2766 2767 2768def getFeatureImportance(apikey, model_id, date, N=None, proxy=None, disable_verify_ssl=False): 2769 """ 2770 Gets the top N features for the given model sorted in descending order of importance 2771 2772 Parameters 2773 ---------- 2774 apikey: str 2775 API key provided by Boosted. This key should be protected as a secret. 2776 model_id: str 2777 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2778 button next to your model's name in the Model Summary Page in Boosted 2779 Insights. 2780 date: datetime.date or YYYY-MM-DD string 2781 Date for the period for which features should be fetched. The resulting features 2782 are fetched for the period the date falls into. E.g. if the date is 2021-11-21 for the 2783 annual model, the features will be provided for the period of 2021-01-01 - 2021-12-31. 2784 N: int 2785 Limit for the number of top features to be returned. If not provided, the entire list 2786 of features will be returned. 2787 proxy: str 2788 Your organization may require the use of a proxy for access. 2789 The address of a HTTPS proxy in the format of <address>:<port>. 2790 Examples are "123.456.789:123" or "my.proxy.com:123". 2791 Do not prepend with "https://". 2792 disable_verify_ssl: bool 2793 Your networking setup may be behind a firewall which performs SSL 2794 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2795 to point to the location of a custom certificate bundle, or set this 2796 parameter to true to disable SSL verification as a workaround. 2797 Returns 2798 ------- 2799 pandas.DataFrame 2800 Pandas DataFrame containing features and their importance 2801 ___ 2802 """ 2803 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2804 return client.getFeatureImportance(model_id, date, N) 2805 2806 2807def getAllModelNames( 2808 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2809) -> Dict[str, str]: 2810 """ 2811 Gets the model names for all models the user has access to. 2812 Parameters 2813 ---------- 2814 apikey: str 2815 API key provided by Boosted. This key should be protected as a secret. 2816 proxy: Optional[str] 2817 Your organization may require the use of a proxy for access. 2818 The address of a HTTPS proxy in the format of <address>:<port>. 2819 Examples are "123.456.789:123" or "my.proxy.com:123". 2820 Do not prepend with "https://". 2821 disable_verify_ssl: bool = False 2822 Your networking setup may be behind a firewall which performs SSL 2823 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2824 to point to the location of a custom certificate bundle, or set this 2825 parameter to true to disable SSL verification as a workaround. 2826 Returns 2827 ------- 2828 dict: 2829 Dictionary mapping model id to model name. 2830 """ 2831 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2832 return client.getAllModelNames() 2833 2834 2835def getAllModelDetails( 2836 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2837) -> Dict[str, Dict[str, Any]]: 2838 """ 2839 Gets the model name, model id, last update time, and associated portfolio 2840 ids for all models the user has access to. 2841 Parameters 2842 ---------- 2843 apikey: str 2844 API key provided by Boosted. This key should be protected as a secret. 2845 proxy: Optional[str] 2846 Your organization may require the use of a proxy for access. 2847 The address of a HTTPS proxy in the format of <address>:<port>. 2848 Examples are "123.456.789:123" or "my.proxy.com:123". 2849 Do not prepend with "https://". 2850 disable_verify_ssl: bool = False 2851 Your networking setup may be behind a firewall which performs SSL 2852 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2853 to point to the location of a custom certificate bundle, or set this 2854 parameter to true to disable SSL verification as a workaround. 2855 Returns 2856 ------- 2857 Dictionary keyed by model id mapping to nested dictionary with the following values: 2858 portfolios: List[Dict[str, str]] 2859 List of portfolio associated with the model. Each portfolio is a dict 2860 with keys "id" and "name". 2861 name: str 2862 Model name. 2863 last_updated: datetime 2864 Last updated time of the model. 2865 """ 2866 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2867 return client.getAllModelDetails() 2868 2869 2870def getEquityAccuracy( 2871 apikey: str, 2872 model_id: str, 2873 portfolio_id: str, 2874 tickers: List[str], 2875 start_date: Optional[BoostedDate] = None, 2876 end_date: Optional[BoostedDate] = None, 2877 proxy: Optional[str] = None, 2878 disable_verify_ssl: bool = False, 2879) -> Dict[str, Dict[str, Any]]: 2880 """ 2881 Retrieves accuracy data for a given portfolio and list of tickers. 2882 Parameters 2883 ---------- 2884 apikey: str 2885 API key provided by Boosted. This key should be protected as a secret. 2886 model_id: str 2887 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2888 button next to your model's name in the Model Summary Page in Boosted 2889 Insights. 2890 portfolio_id: str 2891 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2892 tickers: List[str] 2893 List of tickers to get accuracy information with. 2894 start_date: Optional[datetime | string]: 2895 Optional start date for data. If not specified, will default to the 2896 start date of the portfolio. 2897 end_date: Optional[datetime | string]: 2898 Optional end date for data. If not specified, will default to the 2899 end date of the portfolio. 2900 proxy: Optional[str] 2901 Your organization may require the use of a proxy for access. 2902 The address of a HTTPS proxy in the format of <address>:<port>. 2903 Examples are "123.456.789:123" or "my.proxy.com:123". 2904 Do not prepend with "https://". 2905 disable_verify_ssl: bool = False 2906 Your networking setup may be behind a firewall which performs SSL 2907 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2908 to point to the location of a custom certificate bundle, or set this 2909 parameter to true to disable SSL verification as a workaround. 2910 Returns 2911 ------- 2912 Nested dictionary: 2913 { 2914 "ticker1": { 2915 "hit_rate_mean": pd.DataFrame, 2916 "hit_rate_median": pd.DataFrame, 2917 "excess_return_mean": pd.DataFrame, 2918 "excess_return_median": pd.DataFrame, 2919 "return": "Recalculate the portfolio to get raw returns", 2920 "excess_return": pd.DataFrame, 2921 }, 2922 "ticker2": { 2923 "hit_rate_mean": pd.DataFrame, 2924 "hit_rate_median": pd.DataFrame, 2925 "excess_return_mean": pd.DataFrame, 2926 "excess_return_median": pd.DataFrame, 2927 "return": pd.DataFrame, 2928 "excess_return": pd.DataFrame, 2929 }, 2930 ... 2931 } 2932 Each dataframe above has columns: 2933 1D, 5D, 1M, 3M, 6M, 1Y, 2Y 2934 And row indexes: 2935 Q1, Q2, Q3, Q4, Q5 2936 2937 Note that the value for 'return' may be a string instead of a dataframe in 2938 cases where the data is not currently available in the specified portfolio. 2939 """ 2940 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2941 return client.getEquityAccuracy(model_id, portfolio_id, tickers, start_date, end_date) 2942 2943 2944def getHedgeExperiments( 2945 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2946) -> List[HedgeExperiment]: 2947 """ 2948 Get a list of all hedge experiments. 2949 Parameters 2950 ---------- 2951 apikey: str 2952 API key provided by Boosted. This key should be protected as a secret. 2953 proxy: str 2954 Your organization may require the use of a proxy for access. 2955 The address of a HTTPS proxy in the format of <address>:<port>. 2956 Examples are "123.456.789:123" or "my.proxy.com:123". 2957 Do not prepend with "https://". 2958 disable_verify_ssl: bool 2959 Your networking setup may be behind a firewall which performs SSL 2960 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2961 to point to the location of a custom certificate bundle, or set this 2962 parameter to true to disable SSL verification as a workaround. 2963 Returns 2964 ------- 2965 HedgeExperiment object 2966 Results of the hedge experiment. 2967 """ 2968 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2969 return client.get_hedge_experiments() 2970 2971 2972def getHedgeExperimentDetails( 2973 apikey: str, 2974 experiment_id: str, 2975 proxy: Optional[str] = None, 2976 disable_verify_ssl: bool = False, 2977) -> HedgeExperimentDetails: 2978 """ 2979 Get the details of a specific hedge experiment, as a HedgeExperiement object 2980 Parameters 2981 ---------- 2982 apikey: str 2983 API key provided by Boosted. This key should be protected as a secret. 2984 experiment_id: str 2985 UUID corresponding to the hedge experiment in question. 2986 proxy: str 2987 Your organization may require the use of a proxy for access. 2988 The address of a HTTPS proxy in the format of <address>:<port>. 2989 Examples are "123.456.789:123" or "my.proxy.com:123". 2990 Do not prepend with "https://". 2991 disable_verify_ssl: bool 2992 Your networking setup may be behind a firewall which performs SSL 2993 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2994 to point to the location of a custom certificate bundle, or set this 2995 parameter to true to disable SSL verification as a workaround. 2996 Returns 2997 ------- 2998 HedgeExperiment object 2999 Results of the hedge experiment. 3000 """ 3001 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3002 return client.get_hedge_experiment_details(experiment_id) 3003 3004 3005def getPortfolioPerformance( 3006 apikey: str, 3007 portfolio_id: str, 3008 start_date: Optional[datetime.date] = None, 3009 end_date: Optional[datetime.date] = None, 3010 daily_returns: bool = False, 3011 proxy: Optional[str] = None, 3012 disable_verify_ssl: bool = False, 3013) -> pd.DataFrame: 3014 """ 3015 Get performance data for a portfolio. 3016 3017 Parameters 3018 ---------- 3019 apikey: str 3020 API key provided by Boosted. This key should be protected as a secret. 3021 portfolio_id: str 3022 UUID corresponding to the portfolio in question. 3023 proxy: str 3024 Your organization may require the use of a proxy for access. 3025 The address of a HTTPS proxy in the format of <address>:<port>. 3026 Examples are "123.456.789:123" or "my.proxy.com:123". 3027 Do not prepend with "https://". 3028 disable_verify_ssl: bool 3029 Your networking setup may be behind a firewall which performs SSL 3030 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3031 to point to the location of a custom certificate bundle, or set this 3032 parameter to true to disable SSL verification as a workaround. 3033 start_date: datetime.date 3034 Starting cutoff date to filter performance data 3035 end_date: datetime.date 3036 Ending cutoff date to filter performance data 3037 daily_returns: bool 3038 Flag indicating whether to add a new column with the daily return pct calculated 3039 3040 Returns 3041 ------- 3042 pd.DataFrame object 3043 Portfolio and benchmark performance. 3044 -index: 3045 "date": pd.DatetimeIndex 3046 -columns: 3047 "benchmark": benchmark performance, % return 3048 "turnover": portfolio turnover, % of equity 3049 "portfolio": return since beginning of portfolio, % return 3050 "daily_returns": daily percent change in value of the portfolio, % return 3051 (this column is optional and depends on the daily_returns flag) 3052 """ 3053 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3054 return client.get_portfolio_performance(portfolio_id, start_date, end_date, daily_returns) 3055 3056 3057def getPortfolioFactors( 3058 apikey: str, 3059 model_id: str, 3060 portfolio_id: str, 3061 proxy: Optional[str] = None, 3062 disable_verify_ssl: bool = False, 3063) -> pd.DataFrame: 3064 """ 3065 Get factor data concerning a hedge experiment portfolio 3066 3067 Parameters 3068 ---------- 3069 apikey: str 3070 API key provided by Boosted. This key should be protected as a secret. 3071 model_id: str 3072 UUID corresponding to the model in question. 3073 portfolio_id: str 3074 UUID corresponding to the portfolio in question. 3075 proxy: str 3076 Your organization may require the use of a proxy for access. 3077 The address of a HTTPS proxy in the format of <address>:<port>. 3078 Examples are "123.456.789:123" or "my.proxy.com:123". 3079 Do not prepend with "https://". 3080 disable_verify_ssl: bool 3081 Your networking setup may be behind a firewall which performs SSL 3082 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3083 to point to the location of a custom certificate bundle, or set this 3084 parameter to true to disable SSL verification as a workaround. 3085 3086 Returns 3087 ------- 3088 pd.DataFrame object 3089 - index: 3090 "date": pd.DatetimeIndex 3091 - columns: 3092 The following are factor weights corresponding to the named column. 3093 "size", 3094 "momentum", 3095 "dividend_yield", 3096 "volatility", 3097 "trading_activity", 3098 "value", 3099 "earnings_variability", 3100 "profitability", 3101 "growth", 3102 "leverage", 3103 "income_statement", 3104 "balance_sheet", 3105 "cash_flow", 3106 "environment", 3107 "social", 3108 "governance", 3109 "machine_1", 3110 "machine_2", 3111 "machine_3", 3112 "machine_4", 3113 "machine_5", 3114 "machine_6", 3115 "machine_7", 3116 "machine_8", 3117 "machine_9", 3118 "machine_10" 3119 """ 3120 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3121 return client.get_portfolio_factors(model_id, portfolio_id) 3122 3123 3124def getPortfolioVolatility( 3125 apikey: str, 3126 model_id: str, 3127 portfolio_id: str, 3128 proxy: Optional[str] = None, 3129 disable_verify_ssl: bool = False, 3130) -> pd.DataFrame: 3131 """ 3132 Get volatility data concerning a hedge experiment portfolio 3133 3134 Parameters 3135 ---------- 3136 apikey: str 3137 API key provided by Boosted. This key should be protected as a secret. 3138 model_id: str 3139 UUID corresponding to the model in question. 3140 portfolio_id: str 3141 UUID corresponding to the portfolio in question. 3142 proxy: str 3143 Your organization may require the use of a proxy for access. 3144 The address of a HTTPS proxy in the format of <address>:<port>. 3145 Examples are "123.456.789:123" or "my.proxy.com:123". 3146 Do not prepend with "https://". 3147 disable_verify_ssl: bool 3148 Your networking setup may be behind a firewall which performs SSL 3149 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3150 to point to the location of a custom certificate bundle, or set this 3151 parameter to true to disable SSL verification as a workaround. 3152 3153 Returns 3154 ------- 3155 pd.DataFrame object 3156 - index: 3157 "date": pd.DatetimeIndex 3158 - columns: 3159 "avg_5d", 3160 "avg_10d", 3161 "avg_21d", 3162 "avg_63d", 3163 "avg_126d", 3164 "avg_189d", 3165 "avg_252d", 3166 "avg_315d", 3167 "avg_378d", 3168 "avg_441d", 3169 "avg_504d" 3170 """ 3171 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3172 return client.get_portfolio_volatility(model_id, portfolio_id) 3173 3174 3175def getPortfolioHoldings( 3176 apikey: str, 3177 model_id: str, 3178 portfolio_id: str, 3179 proxy: Optional[str] = None, 3180 disable_verify_ssl: bool = False, 3181) -> pd.DataFrame: 3182 """ 3183 Get holdings concerning a hedge experiment portfolio 3184 3185 Parameters 3186 ---------- 3187 apikey: str 3188 API key provided by Boosted. This key should be protected as a secret. 3189 model_id: str 3190 UUID corresponding to the model in question. 3191 portfolio_id: str 3192 UUID corresponding to the portfolio in question. 3193 proxy: str 3194 Your organization may require the use of a proxy for access. 3195 The address of a HTTPS proxy in the format of <address>:<port>. 3196 Examples are "123.456.789:123" or "my.proxy.com:123". 3197 Do not prepend with "https://". 3198 disable_verify_ssl: bool 3199 Your networking setup may be behind a firewall which performs SSL 3200 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3201 to point to the location of a custom certificate bundle, or set this 3202 parameter to true to disable SSL verification as a workaround. 3203 3204 Returns 3205 ------- 3206 pd.DataFrame object 3207 - index: 3208 "date": pd.DatetimeIndex 3209 - columns: 3210 "ticker", 3211 "isin", 3212 "region", 3213 "currency", 3214 "allocation" 3215 """ 3216 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3217 return client.get_portfolio_holdings(model_id, portfolio_id) 3218 3219 3220def getStockDataTableForDate( 3221 apikey: str, 3222 model_id: str, 3223 portfolio_id: str, 3224 date: BoostedDate = datetime.date.today(), 3225 proxy: Optional[str] = None, 3226 disable_verify_ssl: bool = False, 3227) -> pd.DataFrame: 3228 """ 3229 Returns stock pricing and factors data for a given date. 3230 3231 Parameters 3232 ---------- 3233 apikey: str 3234 API key provided by Boosted. This key should be protected as a secret. 3235 model_id: str 3236 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 3237 button next to your model's name in the Model Summary Page in Boosted 3238 Insights. 3239 portfolio_id: str 3240 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 3241 date: datetime.date | str 3242 Date for which to fetch stock data table. Defaults to today. 3243 proxy: str 3244 Your organization may require the use of a proxy for access. 3245 The address of a HTTPS proxy in the format of <address>:<port>. 3246 Examples are "123.456.789:123" or "my.proxy.com:123". 3247 Do not prepend with "https://". 3248 disable_verify_ssl: bool 3249 Your networking setup may be behind a firewall which performs SSL 3250 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3251 to point to the location of a custom certificate bundle, or set this 3252 parameter to true to disable SSL verification as a workaround. 3253 3254 Returns 3255 ------- 3256 Stock data table as a dataframe indexed by ticker. 3257 """ 3258 date = convert_date(date) 3259 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3260 return client.getStockDataTableForDate(model_id, portfolio_id, date) 3261 3262 3263def addHedgeExperimentScenario( 3264 apikey: str, 3265 experiment_id: str, 3266 scenario_name: str, 3267 scenario_settings: PortfolioSettings, 3268 run_scenario_immediately: bool = True, 3269 proxy: Optional[str] = None, 3270 disable_verify_ssl: bool = False, 3271) -> HedgeExperimentScenario: 3272 """ 3273 Create a hedge experiment scenario the Boosted platform. 3274 3275 Parameters 3276 ---------- 3277 apikey: str 3278 API key provided by Boosted. This key should be protected as a secret. 3279 experiment: HedgeExperiment 3280 An instance of the HedgeExperiment class that specifies 3281 your experiment configuration and metadata. 3282 run_scenario_immediately: Optional[bool] (default True) 3283 Flag that indicates whether to run the scenario upon submission or wait 3284 for a independent call to start the scenario at a later time. 3285 proxy: str 3286 Your organization may require the use of a proxy for access. 3287 The address of a HTTPS proxy in the format of <address>:<port>. 3288 Examples are "123.456.789:123" or "my.proxy.com:123". 3289 Do not prepend with "https://". 3290 disable_verify_ssl: bool 3291 Your networking setup may be behind a firewall which performs SSL 3292 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3293 to point to the location of a custom certificate bundle, or set this 3294 parameter to true to disable SSL verification as a workaround. 3295 3296 Returns 3297 ------- 3298 HedgeExperimentScenario 3299 - A scenario instance with associated metadata 3300 """ 3301 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3302 return client.add_hedge_experiment_scenario( 3303 experiment_id, scenario_name, scenario_settings, run_scenario_immediately 3304 ) 3305 3306 3307def createHedgeExperiment( 3308 apikey: str, 3309 experiment_name: str, 3310 experiment_description: str, 3311 experiment_type: hedge_experiment_type, 3312 target_securities: Union[Dict[GbiIdSecurity, float], str], 3313 proxy: Optional[str] = None, 3314 disable_verify_ssl: bool = False, 3315) -> HedgeExperiment: 3316 """ 3317 Creates a hedge experiment on the Boosted platform, returning an object 3318 representation of it. Note that currently this does NOT start the experiment; 3319 as created, the experiment is in an incomplete, draft state 3320 3321 Parameters 3322 ---------- 3323 apikey: str 3324 API key provided by Boosted. This key should be protected as a secret. 3325 experiment_name: str 3326 Name of the experiment 3327 experiment_description: str 3328 Your description of the experiment. 3329 experiment_type: str 3330 "HEDGE" - hedge out the risk of target securities 3331 "MIMIC" - mimic the target securities 3332 target_securities: Dict[GbiIdSecurity, float] | str 3333 Specification of securities to hedge or mimic as a weighted basket. This parameter 3334 can take the form of: 3335 {GbiIdSecurity: weight} - to manually specify securities and weights, OR 3336 portfolio_id - to use the most recent holdings/allocations of the passed 3337 portfolio as the securities and weights 3338 proxy: str 3339 Your organization may require the use of a proxy for access. 3340 The address of a HTTPS proxy in the format of <address>:<port>. 3341 Examples are "123.456.789:123" or "my.proxy.com:123". 3342 Do not prepend with "https://". 3343 disable_verify_ssl: bool 3344 Your networking setup may be behind a firewall which performs SSL 3345 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3346 to point to the location of a custom certificate bundle, or set this 3347 parameter to true to disable SSL verification as a workaround. 3348 Returns 3349 ------- 3350 HedgeExperiment 3351 """ 3352 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3353 return client.create_hedge_experiment( 3354 experiment_name, 3355 experiment_description, 3356 experiment_type, 3357 target_securities=target_securities, 3358 ) 3359 3360 3361def modifyHedgeExperiment( 3362 apikey: str, 3363 experiment_id: str, 3364 experiment_name: Optional[str] = None, 3365 experiment_description: Optional[str] = None, 3366 experiment_type: Optional[hedge_experiment_type] = None, 3367 target_securities: Union[Dict[GbiIdSecurity, float], str, None] = None, 3368 model_ids: Optional[List[str]] = None, 3369 stock_universe_ids: Optional[List[str]] = None, 3370 create_default_scenario: bool = True, 3371 baseline_model_id: Optional[str] = None, 3372 baseline_stock_universe_id: Optional[str] = None, 3373 baseline_portfolio_settings: Optional[str] = None, 3374 proxy: Optional[str] = None, 3375 disable_verify_ssl: bool = False, 3376) -> HedgeExperiment: 3377 """ 3378 Modifies an existing hedge experiment on the Boosted platform, returning an object 3379 representation of it. Note that currently this does NOT start the experiment; 3380 a modified experiment is still in a draft state. 3381 3382 Parameters 3383 ---------- 3384 apikey: str 3385 API key provided by Boosted. This key should be protected as a secret. 3386 experiment_name: str 3387 Name of the experiment 3388 experiment_description: str 3389 Your description of the experiment. 3390 experiment_type: str 3391 "HEDGE" - hedge out the risk of target securities 3392 "MIMIC" - mimic the target securities 3393 target_securities: Dict[GbiIdSecurity, float] | str | None (default) 3394 Specification of securities to hedge or mimic as a weighted basket. This parameter 3395 can take the form of: 3396 {GbiIdSecurity: weight} - to manually specify securities and weights, OR 3397 portfolio_id - to use the most recent holdings/allocations of the passed 3398 portfolio as the securities and weights 3399 model_ids: List[str] 3400 A list of model ids that will be used for constructing scenario portfolios 3401 stock_universe_ids: List[str] 3402 A list of stock universe ids that will be used for constructing scenario portfolios 3403 create_default_scenario: bool 3404 Whether to create a "default/inferred" scenario 3405 baseline_model_id: str 3406 Model id to (optionally) use for the baseline portfolio 3407 baseline_stock_universe_id: str 3408 Universe id to use for the baseline portfolio 3409 baseline_portfolio_settings: str 3410 A valid json-string specifying settings for the baseline portfolio 3411 proxy: str 3412 Your organization may require the use of a proxy for access. 3413 The address of a HTTPS proxy in the format of <address>:<port>. 3414 Examples are "123.456.789:123" or "my.proxy.com:123". 3415 Do not prepend with "https://". 3416 disable_verify_ssl: bool 3417 Your networking setup may be behind a firewall which performs SSL 3418 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3419 to point to the location of a custom certificate bundle, or set this 3420 parameter to true to disable SSL verification as a workaround. 3421 3422 Returns 3423 ------- 3424 HedgeExperiment 3425 """ 3426 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3427 return client.modify_hedge_experiment( 3428 experiment_id, 3429 name=experiment_name, 3430 description=experiment_description, 3431 experiment_type=experiment_type, 3432 target_securities=target_securities, 3433 model_ids=model_ids, 3434 stock_universe_ids=stock_universe_ids, 3435 create_default_scenario=create_default_scenario, 3436 baseline_model_id=baseline_model_id, 3437 baseline_stock_universe_id=baseline_stock_universe_id, 3438 baseline_portfolio_settings=baseline_portfolio_settings, 3439 ) 3440 3441 3442def startHedgeExperiment( 3443 apikey: str, 3444 experiment_id: str, 3445 *scenario_ids: str, 3446 proxy: Optional[str] = None, 3447 disable_verify_ssl: bool = False, 3448) -> HedgeExperiment: 3449 """ 3450 Starts an existing hedge experiment on the Boosted platform, returning an object 3451 representation of it. This function also starts the indicated scenarios. 3452 3453 Parameters 3454 ---------- 3455 apikey: str 3456 API key provided by Boosted. This key should be protected as a secret. 3457 experiment_name: str 3458 Name of the experiment 3459 scenario_ids: str 3460 Var-args corresponding to scenario ids that you would like to start. 3461 proxy: str 3462 Your organization may require the use of a proxy for access. 3463 The address of a HTTPS proxy in the format of <address>:<port>. 3464 Examples are "123.456.789:123" or "my.proxy.com:123". 3465 Do not prepend with "https://". 3466 disable_verify_ssl: bool 3467 Your networking setup may be behind a firewall which performs SSL 3468 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3469 to point to the location of a custom certificate bundle, or set this 3470 parameter to true to disable SSL verification as a workaround. 3471 3472 Returns 3473 ------- 3474 HedgeExperiment 3475 """ 3476 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3477 return client.start_hedge_experiment(experiment_id, *scenario_ids) 3478 3479 3480def deleteHedgeExperiment( 3481 apikey: str, experiment_id: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 3482) -> bool: 3483 """ 3484 Deletes a hedge experiment and all associated scenarios. This is a permanent, 3485 irreversible action! 3486 3487 Parameters 3488 ---------- 3489 apikey: str 3490 API key provided by Boosted. This key should be protected as a secret. 3491 experiment_name: str 3492 Name of the experiment 3493 proxy: str 3494 Your organization may require the use of a proxy for access. 3495 The address of a HTTPS proxy in the format of <address>:<port>. 3496 Examples are "123.456.789:123" or "my.proxy.com:123". 3497 Do not prepend with "https://". 3498 disable_verify_ssl: bool 3499 Your networking setup may be behind a firewall which performs SSL 3500 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3501 to point to the location of a custom certificate bundle, or set this 3502 parameter to true to disable SSL verification as a workaround. 3503 3504 Returns 3505 ------- 3506 None 3507 """ 3508 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3509 return client.delete_hedge_experiment(experiment_id) 3510 3511 3512def createHedgeBasketPositionBoundsFromCsv( 3513 apikey: str, 3514 filepath: str, 3515 name: str, 3516 description: Optional[str] = None, 3517 mapping_result_filepath: Optional[str] = None, 3518 proxy: Optional[str] = None, 3519 disable_verify_ssl: bool = False, 3520) -> str: 3521 """ 3522 Creates a hedge basket security-level position bounds template setting from 3523 an input CSV of ISINs and weight constraints. 3524 3525 Parameters 3526 ---------- 3527 apikey: str 3528 API key provided by Boosted. This key should be protected as a secret. 3529 filepath: str 3530 Path to csv file from which to create the position bounds template. 3531 Required Columns: 3532 ISIN: str 3533 Lower Bound: float, 0-1 3534 Upper Bound: float, 0-1 3535 Optional Columns for use in security mapping: 3536 Date: str, ISO format 3537 Country: str, ISO format 3538 Currency: str, ISO format 3539 name: str 3540 name for the position bounds template 3541 description: str 3542 optional description for the position bounds template 3543 mapping_result_filepath: str 3544 if provided, writes the result of the mapping to this file location 3545 proxy: str 3546 Your organization may require the use of a proxy for access. 3547 The address of a HTTPS proxy in the format of <address>:<port>. 3548 Examples are "123.456.789:123" or "my.proxy.com:123". 3549 Do not prepend with "https://". 3550 disable_verify_ssl: bool 3551 Your networking setup may be behind a firewall which performs SSL 3552 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3553 to point to the location of a custom certificate bundle, or set this 3554 parameter to true to disable SSL verification as a workaround. 3555 3556 Returns 3557 ------- 3558 template_id: str 3559 UUID to identify the newly created position bounds template in the UI. 3560 """ 3561 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3562 return client.create_hedge_basket_position_bounds_from_csv( 3563 filepath, name, description, mapping_result_filepath 3564 ) 3565 3566 3567def getHitRateFile( 3568 apikey: str, 3569 model_id: str, 3570 portfolio_id: str, 3571 file_key: str, 3572 proxy: Optional[str] = None, 3573 disable_verify_ssl: bool = False, 3574) -> dict: 3575 """ 3576 Returns the hit rate file given a model ID, portfolio ID, and file name, if it exists. 3577 Args: 3578 apikey: str 3579 API key provided by Boosted. This key should be protected as a secret. 3580 model_id: str 3581 Model ID associated with the file 3582 portfolio_id: str 3583 Portfolio ID associated with the file 3584 file_key: str 3585 The file name (will most often be a UUID) 3586 proxy: str 3587 Your organization may require the use of a proxy for access. 3588 The address of a HTTPS proxy in the format of <address>:<port>. 3589 Examples are "123.456.789:123" or "my.proxy.com:123". 3590 Do not prepend with "https://". 3591 disable_verify_ssl: bool 3592 Your networking setup may be behind a firewall which performs SSL 3593 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3594 to point to the location of a custom certificate bundle, or set this 3595 parameter to true to disable SSL verification as a workaround. 3596 3597 Returns: 3598 dict: Hit Rate data 3599 """ 3600 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3601 return client.get_hit_rate_file(model_id=model_id, portfolio_id=portfolio_id, file_key=file_key) 3602 3603 3604def getHitRateWithSecurities( 3605 apikey: str, 3606 model_id: str, 3607 portfolio_id: str, 3608 meet_all_conditions: bool = False, 3609 securities: List[str] = [], 3610 countries: List[str] = [], 3611 sectors: List[str] = [], 3612 start_date: Optional[BoostedDate] = None, 3613 end_date: Optional[BoostedDate] = None, 3614 proxy: Optional[str] = None, 3615 disable_verify_ssl: bool = False, 3616) -> dict: 3617 """ 3618 Generate a hit rate file for a portfolio given securities/sectors/countries for filtering. 3619 Args: 3620 apikey: str 3621 API key provided by Boosted. This key should be protected as a secret. 3622 model_id: str 3623 Model ID 3624 portfolio_id: str 3625 Portfolio ID to use for the hit rate data 3626 meet_all_conditions: 3627 If True, must meet all non-empty filters 3628 securities: List[str] 3629 List of securities in ISIN format 3630 countries: List[str] 3631 List of countries in ISO3 format 3632 sectors: List[str] 3633 List of GICS sectors 3634 start_date: Optional[date] 3635 Start of date range for the hit rate data. Defaults to 5 weeks ago, 3636 or 5 weeks minus the start date. 3637 end_date: Optional[date] 3638 End of date range for the hit rate data. Defaults to today, or 3639 5 weeks plus the end_date. 3640 proxy: str 3641 Your organization may require the use of a proxy for access. 3642 The address of a HTTPS proxy in the format of <address>:<port>. 3643 Examples are "123.456.789:123" or "my.proxy.com:123". 3644 Do not prepend with "https://". 3645 disable_verify_ssl: bool 3646 Your networking setup may be behind a firewall which performs SSL 3647 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3648 to point to the location of a custom certificate bundle, or set this 3649 parameter to true to disable SSL verification as a workaround. 3650 3651 Returns: 3652 dict with three key-value pairs: 3653 "portfolio_id": portfolio ID 3654 "model_id" model ID 3655 "file_name" file key of the hit rate file. 3656 "gbi_ids" all ISINs that were included and used after filtering 3657 3658 Note that it will take up to 3 minutes for the hit rate file 3659 to generate after this API returns, before you can call getHitRateFile. 3660 """ 3661 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3662 return client.get_hit_rate_with_securities( 3663 model_id=model_id, 3664 portfolio_id=portfolio_id, 3665 meet_all_conditions=meet_all_conditions, 3666 securities=securities, 3667 countries=countries, 3668 sectors=sectors, 3669 start_date=start_date, 3670 end_date=end_date, 3671 ) 3672 3673 3674def getPortfolioAccuracy( 3675 apikey: str, 3676 model_id: str, 3677 portfolio_id: str, 3678 proxy: Optional[str] = None, 3679 disable_verify_ssl: bool = False, 3680 start_date: Optional[BoostedDate] = None, 3681 end_date: Optional[BoostedDate] = None, 3682) -> dict: 3683 """ 3684 Get the accuracy (hit rate & excess return) information of a given portfolio. 3685 Parameters 3686 ---------- 3687 apikey: str 3688 API key provided by Boosted. This key should be protected as a secret. 3689 model_id: str 3690 Model ID of the portfolio to fetch data for. 3691 portfolio_id: str 3692 ID of the portfolio to fetch data for. 3693 proxy: str 3694 Your organization may require the use of a proxy for access. 3695 The address of a HTTPS proxy in the format of <address>:<port>. 3696 Examples are "123.456.789:123" or "my.proxy.com:123". 3697 Do not prepend with "https://". 3698 disable_verify_ssl: bool 3699 Your networking setup may be behind a firewall which performs SSL 3700 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3701 to point to the location of a custom certificate bundle, or set this 3702 parameter to true to disable SSL verification as a workaround. 3703 start_date: Optional[datetime.date | str] 3704 Start date for portfolio accuracy date range. If this or end_date is 3705 omitted, full history will be returned. 3706 end_date: Optional[datetime.date | str] 3707 End date for portfolio accuracy date range. If this or start_date is 3708 omitted, full history will be returned. 3709 3710 Returns 3711 ------- 3712 accuracy: dict 3713 Dictionary containing accuracy information by Quantile, Decile and Ventile. 3714 """ 3715 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3716 return client.get_portfolio_accuracy( 3717 model_id, portfolio_id, start_date=start_date, end_date=end_date 3718 ) 3719 3720 3721def createWatchlist( 3722 apikey: str, 3723 name: str, 3724 proxy: Optional[str] = None, 3725 disable_verify_ssl: bool = False, 3726) -> str: 3727 """ 3728 Create a watchlist and get back the watchlist_id for it 3729 3730 Parameters 3731 ---------- 3732 apikey: str 3733 API key provided by Boosted. This key should be protected as a secret. 3734 name: str 3735 Name to associate with the watchlist 3736 proxy: str 3737 Your organization may require the use of a proxy for access. 3738 The address of a HTTPS proxy in the format of <address>:<port>. 3739 Examples are "123.456.789:123" or "my.proxy.com:123". 3740 Do not prepend with "https://". 3741 disable_verify_ssl: bool 3742 Your networking setup may be behind a firewall which performs SSL 3743 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3744 to point to the location of a custom certificate bundle, or set this 3745 parameter to true to disable SSL verification as a workaround. 3746 Returns 3747 ------- 3748 watchlist_id: str 3749 UUID to uniquely identify the newly created watchlist 3750 """ 3751 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3752 return client.create_watchlist(name) 3753 3754 3755def createWatchlistFromFile( 3756 apikey: str, 3757 name: str, 3758 filepath: str, 3759 proxy: Optional[str] = None, 3760 disable_verify_ssl: bool = False, 3761) -> str: 3762 """ 3763 Create a watchlist and get back the watchlist_id for it 3764 3765 Parameters 3766 ---------- 3767 apikey: str 3768 API key provided by Boosted. This key should be protected as a secret. 3769 name: str 3770 Name to associate with the watchlist 3771 filepath: str 3772 path to file to upload, 3773 proxy: str 3774 Your organization may require the use of a proxy for access. 3775 The address of a HTTPS proxy in the format of <address>:<port>. 3776 Examples are "123.456.789:123" or "my.proxy.com:123". 3777 Do not prepend with "https://". 3778 disable_verify_ssl: bool 3779 Your networking setup may be behind a firewall which performs SSL 3780 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3781 to point to the location of a custom certificate bundle, or set this 3782 parameter to true to disable SSL verification as a workaround. 3783 Returns 3784 ------- 3785 watchlist_id: str 3786 UUID to uniquely identify the newly created watchlist 3787 """ 3788 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3789 return client.create_watchlist_from_file(name, filepath) 3790 3791 3792def getWatchlists( 3793 apikey: str, 3794 proxy: Optional[str] = None, 3795 disable_verify_ssl: bool = False, 3796) -> List[Dict]: 3797 """ 3798 Get the list of watchlists 3799 3800 Parameters 3801 ---------- 3802 apikey: str 3803 API key provided by Boosted. This key should be protected as a secret. 3804 proxy: str 3805 Your organization may require the use of a proxy for access. 3806 The address of a HTTPS proxy in the format of <address>:<port>. 3807 Examples are "123.456.789:123" or "my.proxy.com:123". 3808 Do not prepend with "https://". 3809 disable_verify_ssl: bool 3810 Your networking setup may be behind a firewall which performs SSL 3811 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3812 to point to the location of a custom certificate bundle, or set this 3813 parameter to true to disable SSL verification as a workaround. 3814 Returns 3815 ------- 3816 watchlists: List[Dict] 3817 List of dictionaries with watchlist_id and name 3818 """ 3819 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3820 return client.get_watchlists() 3821 3822 3823def getWatchlistContents( 3824 apikey: str, 3825 watchlist_id: str, 3826 proxy: Optional[str] = None, 3827 disable_verify_ssl: bool = False, 3828) -> Dict: 3829 """ 3830 Add a list of ISINs to a watchlist 3831 Parameters 3832 ---------- 3833 apikey: str 3834 API key provided by Boosted. This key should be protected as a secret. 3835 watchlist_id: str 3836 The UUID for an existing watchlist that the user has read access to 3837 proxy: str 3838 Your organization may require the use of a proxy for access. 3839 The address of a HTTPS proxy in the format of <address>:<port>. 3840 Examples are "123.456.789:123" or "my.proxy.com:123". 3841 Do not prepend with "https://". 3842 disable_verify_ssl: bool 3843 Your networking setup may be behind a firewall which performs SSL 3844 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3845 to point to the location of a custom certificate bundle, or set this 3846 parameter to true to disable SSL verification as a workaround. 3847 Returns 3848 ------- 3849 Information suitable to recreate the watchlist 3850 Dict { 3851 "watchlist_id": str 3852 "contents": List[Dict] 3853 Keys: 'ISIN' 'TICKER', 'COUNTRY', 'CURRENCY', 'CATEGORY' 3854 } 3855 3856 """ 3857 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3858 return client.get_watchlist_contents(watchlist_id) 3859 3860 3861def getWatchlistContentsAsCsv( 3862 apikey: str, 3863 watchlist_id: str, 3864 filepath: str, 3865 proxy: Optional[str] = None, 3866 disable_verify_ssl: bool = False, 3867) -> None: 3868 """ 3869 Get Watchlist securities in csv format 3870 Parameters 3871 ---------- 3872 apikey: str 3873 API key provided by Boosted. This key should be protected as a secret. 3874 watchlist_id: str 3875 The UUID for an existing watchlist that the user has read access to 3876 filepath: str 3877 Destination for csv file to be written to 3878 proxy: str 3879 Your organization may require the use of a proxy for access. 3880 The address of a HTTPS proxy in the format of <address>:<port>. 3881 Examples are "123.456.789:123" or "my.proxy.com:123". 3882 Do not prepend with "https://". 3883 disable_verify_ssl: bool 3884 Your networking setup may be behind a firewall which performs SSL 3885 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3886 to point to the location of a custom certificate bundle, or set this 3887 parameter to true to disable SSL verification as a workaround. 3888 Returns 3889 ------- 3890 None 3891 """ 3892 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3893 return client.get_watchlist_contents_as_csv(watchlist_id, filepath) 3894 3895 3896def getCoverageInfo( 3897 apikey: str, 3898 watchlist_id: str, 3899 portfolio_group_id: str, 3900 proxy: Optional[str] = None, 3901 disable_verify_ssl: bool = False, 3902) -> pd.DataFrame: 3903 """ 3904 Get Coverage info for a given watchlist and portfolio group 3905 Parameters 3906 ---------- 3907 apikey: str 3908 API key provided by Boosted. This key should be protected as a secret. 3909 watchlist_id: str 3910 The UUID for an existing watchlist that the user has read access to 3911 portfolio_group_id: str 3912 The UUID for an existing portfolio group that the user has read access to 3913 proxy: str 3914 Your organization may require the use of a proxy for access. 3915 The address of a HTTPS proxy in the format of <address>:<port>. 3916 Examples are "123.456.789:123" or "my.proxy.com:123". 3917 Do not prepend with "https://". 3918 disable_verify_ssl: bool 3919 Your networking setup may be behind a firewall which performs SSL 3920 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3921 to point to the location of a custom certificate bundle, or set this 3922 parameter to true to disable SSL verification as a workaround. 3923 Returns 3924 ------- 3925 pd.DataFrame 3926 """ 3927 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3928 return client.get_coverage_info(watchlist_id, portfolio_group_id) 3929 3930 3931def getCoverageCsv( 3932 apikey: str, 3933 watchlist_id: str, 3934 portfolio_group_id: str, 3935 filepath: Optional[str], 3936 proxy: Optional[str] = None, 3937 disable_verify_ssl: bool = False, 3938) -> Optional[str]: 3939 """ 3940 Get Coverage info for a given watchlist and portfolio group 3941 Parameters 3942 ---------- 3943 apikey: str 3944 API key provided by Boosted. This key should be protected as a secret. 3945 watchlist_id: str 3946 The UUID for an existing watchlist that the user has read access to 3947 portfolio_group_id: str 3948 The UUID for an existing portfolio group that the user has read access to 3949 filepath: Optional[str] = None 3950 The location to write csv file to 3951 proxy: str 3952 Your organization may require the use of a proxy for access. 3953 The address of a HTTPS proxy in the format of <address>:<port>. 3954 Examples are "123.456.789:123" or "my.proxy.com:123". 3955 Do not prepend with "https://". 3956 disable_verify_ssl: bool 3957 Your networking setup may be behind a firewall which performs SSL 3958 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3959 to point to the location of a custom certificate bundle, or set this 3960 parameter to true to disable SSL verification as a workaround. 3961 Returns 3962 ------- 3963 None if filepath is provided, else a string with a csv's contents is returned 3964 """ 3965 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3966 return client.get_coverage_csv(watchlist_id, portfolio_group_id, filepath) 3967 3968 3969def addSecuritiesToWatchlist( 3970 apikey: str, 3971 watchlist_id: str, 3972 identifiers: List[str], 3973 identifier_type: Literal["TICKER", "ISIN"], 3974 proxy: Optional[str] = None, 3975 disable_verify_ssl: bool = False, 3976) -> Dict: 3977 """ 3978 Add a list of ISINs to a watchlist 3979 Parameters 3980 ---------- 3981 apikey: str 3982 API key provided by Boosted. This key should be protected as a secret. 3983 watchlist_id: str 3984 The UUID for an existing watchlist that the user has write access to 3985 identifiers: List[str] 3986 The list of identifiers to be added to the watchlist. These identifiers can 3987 be tickers or ISINs. See identifier_type. 3988 identifier_type: Literal["TICKER", "ISIN"] 3989 Specifier for the type of identifier. 3990 proxy: str 3991 Your organization may require the use of a proxy for access. 3992 The address of a HTTPS proxy in the format of <address>:<port>. 3993 Examples are "123.456.789:123" or "my.proxy.com:123". 3994 Do not prepend with "https://". 3995 disable_verify_ssl: bool 3996 Your networking setup may be behind a firewall which performs SSL 3997 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3998 to point to the location of a custom certificate bundle, or set this 3999 parameter to true to disable SSL verification as a workaround. 4000 Returns 4001 ------- 4002 status: Dict #FIXME - im not sure what we want to return here 4003 Information about what was modified to in the watchlist 4004 """ 4005 if identifier_type not in ["TICKER", "ISIN"]: 4006 raise ValueError( 4007 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4008 ) 4009 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4010 return client.add_securities_to_watchlist(watchlist_id, identifiers, identifier_type) 4011 4012 4013def removeSecuritiesFromWatchlist( 4014 apikey: str, 4015 watchlist_id: str, 4016 identifiers: List[str], 4017 identifier_type: Literal["TICKER", "ISIN"], 4018 proxy: Optional[str] = None, 4019 disable_verify_ssl: bool = False, 4020) -> Dict: 4021 """ 4022 Add a list of ISINs to a watchlist 4023 Parameters 4024 ---------- 4025 apikey: str 4026 API key provided by Boosted. This key should be protected as a secret. 4027 watchlist_id: str 4028 The UUID for an existing watchlist that the user has write access to 4029 identifiers: List[str] 4030 The list of identifiers to be added to the watchlist. These identifiers can 4031 be tickers or ISINs. See identifier_type. 4032 identifier_type: Literal["TICKER", "ISIN"] 4033 Specifier for the type of identifier. 4034 proxy: str 4035 Your organization may require the use of a proxy for access. 4036 The address of a HTTPS proxy in the format of <address>:<port>. 4037 Examples are "123.456.789:123" or "my.proxy.com:123". 4038 Do not prepend with "https://". 4039 disable_verify_ssl: bool 4040 Your networking setup may be behind a firewall which performs SSL 4041 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4042 to point to the location of a custom certificate bundle, or set this 4043 parameter to true to disable SSL verification as a workaround. 4044 Returns 4045 ------- 4046 status: Dict #FIXME - im not sure what we want to return here 4047 Information about what was modified to in the watchlist 4048 """ 4049 if identifier_type not in ["TICKER", "ISIN"]: 4050 raise ValueError( 4051 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4052 ) 4053 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4054 return client.remove_securities_from_watchlist(watchlist_id, identifiers, identifier_type) 4055 4056 4057def setPortfolioGroupForWatchlist( 4058 apikey: str, 4059 portfolio_group_id: str, 4060 watchlist_id: str, 4061 proxy: Optional[str] = None, 4062 disable_verify_ssl: bool = False, 4063) -> Dict: 4064 """ 4065 Set portfolio group for watchlist. 4066 4067 Parameters 4068 ---------- 4069 apikey: str 4070 API key provided by Boosted. This key should be protected as a secret. 4071 portfolio_group_id: str, 4072 UUID str identifying a portfolio group 4073 watchlist_id: str, 4074 UUID str identifying a watchlist 4075 proxy: str 4076 Your organization may require the use of a proxy for access. 4077 The address of a HTTPS proxy in the format of <address>:<port>. 4078 Examples are "123.456.789:123" or "my.proxy.com:123". 4079 Do not prepend with "https://". 4080 disable_verify_ssl: bool 4081 Your networking setup may be behind a firewall which performs SSL 4082 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4083 to point to the location of a custom certificate bundle, or set this 4084 parameter to true to disable SSL verification as a workaround. 4085 Returns 4086 ------- 4087 Dict: with a list of all portfolio groups for the user 4088 """ 4089 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4090 return client.set_portfolio_group_for_watchlist(portfolio_group_id, watchlist_id) 4091 4092 4093def setStickyPortfolioGroup( 4094 apikey: str, 4095 portfolio_group_id: str, 4096 proxy: Optional[str] = None, 4097 disable_verify_ssl: bool = False, 4098) -> Dict: 4099 """ 4100 Set sticky portfolio group for the user. 4101 4102 Parameters 4103 ---------- 4104 apikey: str 4105 API key provided by Boosted. This key should be protected as a secret. 4106 portfolio_group_id: str, 4107 UUID str identifying a portfolio group 4108 proxy: str 4109 Your organization may require the use of a proxy for access. 4110 The address of a HTTPS proxy in the format of <address>:<port>. 4111 Examples are "123.456.789:123" or "my.proxy.com:123". 4112 Do not prepend with "https://". 4113 disable_verify_ssl: bool 4114 Your networking setup may be behind a firewall which performs SSL 4115 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4116 to point to the location of a custom certificate bundle, or set this 4117 parameter to true to disable SSL verification as a workaround. 4118 Returns 4119 ------- 4120 Dict: with a list of all portfolio groups for the user 4121 """ 4122 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4123 return client.set_sticky_portfolio_group(portfolio_group_id) 4124 4125 4126def getStickyPortfolioGroup( 4127 apikey: str, 4128 proxy: Optional[str] = None, 4129 disable_verify_ssl: bool = False, 4130) -> Dict: 4131 """ 4132 Get sticky portfolio group for the user. 4133 4134 Parameters 4135 ---------- 4136 apikey: str 4137 API key provided by Boosted. This key should be protected as a secret. 4138 proxy: str 4139 Your organization may require the use of a proxy for access. 4140 The address of a HTTPS proxy in the format of <address>:<port>. 4141 Examples are "123.456.789:123" or "my.proxy.com:123". 4142 Do not prepend with "https://". 4143 disable_verify_ssl: bool 4144 Your networking setup may be behind a firewall which performs SSL 4145 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4146 to point to the location of a custom certificate bundle, or set this 4147 parameter to true to disable SSL verification as a workaround. 4148 Returns 4149 ------- 4150 Dict { 4151 group_id: str 4152 group_name: str 4153 portfolios: List[PortfolioInGroup(Dict)] 4154 PortfolioInGroup(Dict): 4155 portfolio_id: str 4156 rank_in_group: Optional[int] = None 4157 portfolio_name: Optional[str] = None 4158 } 4159 """ 4160 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4161 return client.get_sticky_portfolio_group() 4162 4163 4164def getPortfolioGroup( 4165 apikey: str, 4166 portfolio_group_id: str, 4167 proxy: Optional[str] = None, 4168 disable_verify_ssl: bool = False, 4169) -> Dict: 4170 """ 4171 Get a single portfolio group. 4172 4173 Parameters 4174 ---------- 4175 apikey: str 4176 API key provided by Boosted. This key should be protected as a secret. 4177 portfolio_group_id: str, 4178 UUID str identifying a portfolio group 4179 proxy: str 4180 Your organization may require the use of a proxy for access. 4181 The address of a HTTPS proxy in the format of <address>:<port>. 4182 Examples are "123.456.789:123" or "my.proxy.com:123". 4183 Do not prepend with "https://". 4184 disable_verify_ssl: bool 4185 Your networking setup may be behind a firewall which performs SSL 4186 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4187 to point to the location of a custom certificate bundle, or set this 4188 parameter to true to disable SSL verification as a workaround. 4189 Returns 4190 ------- 4191 PortfolioGroup: Dict: { 4192 group_id: str 4193 group_name: str 4194 portfolios: List[PortfolioInGroup] 4195 } 4196 where PortfolioInGroup is defined as = Dict { 4197 portfolio_id: str 4198 portfolio_name: str 4199 rank_in_group: Optional[int] 4200 } 4201 """ 4202 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4203 return client.get_portfolio_group(portfolio_group_id) 4204 4205 4206def getPortfolioGroups( 4207 apikey: str, 4208 proxy: Optional[str] = None, 4209 disable_verify_ssl: bool = False, 4210) -> Dict: 4211 """ 4212 Get a list of all portfolio groups for the user 4213 4214 Parameters 4215 ---------- 4216 apikey: str 4217 API key provided by Boosted. This key should be protected as a secret. 4218 proxy: str 4219 Your organization may require the use of a proxy for access. 4220 The address of a HTTPS proxy in the format of <address>:<port>. 4221 Examples are "123.456.789:123" or "my.proxy.com:123". 4222 Do not prepend with "https://". 4223 disable_verify_ssl: bool 4224 Your networking setup may be behind a firewall which performs SSL 4225 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4226 to point to the location of a custom certificate bundle, or set this 4227 parameter to true to disable SSL verification as a workaround. 4228 Returns 4229 ------- 4230 Dict: with a list of all portfolio groups for the user 4231 """ 4232 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4233 return client.get_portfolio_groups() 4234 4235 4236def createPortfolioGroup( 4237 apikey: str, 4238 group_name: str, 4239 portfolios: Optional[List[Dict]] = None, 4240 proxy: Optional[str] = None, 4241 disable_verify_ssl: bool = False, 4242) -> Dict: 4243 """ 4244 Create a new portfolio group 4245 4246 Parameters 4247 ---------- 4248 apikey: str 4249 API key provided by Boosted. This key should be protected as a secret. 4250 4251 group_name: str 4252 name of the new group 4253 4254 portfolios: List of Dict [: 4255 4256 portfolio_id: str 4257 rank_in_group: Optional[int] = None 4258 ] 4259 4260 proxy: str 4261 Your organization may require the use of a proxy for access. 4262 The address of a HTTPS proxy in the format of <address>:<port>. 4263 Examples are "123.456.789:123" or "my.proxy.com:123". 4264 Do not prepend with "https://". 4265 disable_verify_ssl: bool 4266 Your networking setup may be behind a firewall which performs SSL 4267 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4268 to point to the location of a custom certificate bundle, or set this 4269 parameter to true to disable SSL verification as a workaround. 4270 4271 4272 Returns: 4273 ---------- 4274 4275 Dict: { 4276 group_id: str 4277 UUID identifier for the portfolio group 4278 4279 created: int 4280 num groups created, 1 == success 4281 4282 added: int 4283 num portfolios added to the group, should match the length of 'portfolios' argument 4284 } 4285 4286 """ 4287 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4288 return client.create_portfolio_group(group_name, portfolios) 4289 4290 4291def renamePortfolioGroup( 4292 apikey: str, 4293 group_id: str, 4294 group_name: str, 4295 proxy: Optional[str] = None, 4296 disable_verify_ssl: bool = False, 4297) -> Dict: 4298 """ 4299 Rename a portfolio group 4300 4301 Parameters 4302 ---------- 4303 apikey: str 4304 API key provided by Boosted. This key should be protected as a secret. 4305 4306 group_id: str, 4307 UUID str identifying a portfolio group 4308 4309 group_name: str, 4310 The new name for the porfolio 4311 4312 proxy: str 4313 Your organization may require the use of a proxy for access. 4314 The address of a HTTPS proxy in the format of <address>:<port>. 4315 Examples are "123.456.789:123" or "my.proxy.com:123". 4316 Do not prepend with "https://". 4317 disable_verify_ssl: bool 4318 Your networking setup may be behind a firewall which performs SSL 4319 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4320 to point to the location of a custom certificate bundle, or set this 4321 parameter to true to disable SSL verification as a workaround. 4322 4323 Returns: 4324 ------- 4325 Dict { 4326 changed: int - 1 == success 4327 } 4328 """ 4329 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4330 return client.rename_portfolio_group(group_id, group_name) 4331 4332 4333def addToPortfolioGroup( 4334 apikey: str, 4335 group_id: str, 4336 portfolios: List[Dict], 4337 proxy: Optional[str] = None, 4338 disable_verify_ssl: bool = False, 4339) -> Dict: 4340 """ 4341 Add portfolios to a group 4342 4343 Parameters 4344 ---------- 4345 apikey: str 4346 API key provided by Boosted. This key should be protected as a secret. 4347 4348 group_id: str, 4349 UUID str identifying a portfolio group 4350 4351 portfolios: List of Dict [: 4352 portfolio_id: str 4353 rank_in_group: Optional[int] = None 4354 ] 4355 4356 4357 proxy: str 4358 Your organization may require the use of a proxy for access. 4359 The address of a HTTPS proxy in the format of <address>:<port>. 4360 Examples are "123.456.789:123" or "my.proxy.com:123". 4361 Do not prepend with "https://". 4362 disable_verify_ssl: bool 4363 Your networking setup may be behind a firewall which performs SSL 4364 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4365 to point to the location of a custom certificate bundle, or set this 4366 parameter to true to disable SSL verification as a workaround. 4367 4368 4369 Returns: 4370 ------- 4371 Dict { 4372 added: int 4373 number of successful changes 4374 } 4375 """ 4376 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4377 return client.add_to_portfolio_group(group_id, portfolios) 4378 4379 4380def removeFromPortfolioGroup( 4381 apikey: str, 4382 group_id: str, 4383 portfolios: List[str], 4384 proxy: Optional[str] = None, 4385 disable_verify_ssl: bool = False, 4386) -> Dict: 4387 """ 4388 Remove portfolios from a group 4389 4390 Parameters 4391 ---------- 4392 apikey: str 4393 API key provided by Boosted. This key should be protected as a secret. 4394 4395 group_id: str, 4396 UUID str identifying a portfolio group 4397 4398 portfolios: List of str 4399 4400 4401 proxy: str 4402 Your organization may require the use of a proxy for access. 4403 The address of a HTTPS proxy in the format of <address>:<port>. 4404 Examples are "123.456.789:123" or "my.proxy.com:123". 4405 Do not prepend with "https://". 4406 disable_verify_ssl: bool 4407 Your networking setup may be behind a firewall which performs SSL 4408 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4409 to point to the location of a custom certificate bundle, or set this 4410 parameter to true to disable SSL verification as a workaround. 4411 4412 4413 Returns: 4414 ------- 4415 Dict { 4416 removed: int 4417 number of successful changes 4418 } 4419 """ 4420 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4421 return client.remove_from_portfolio_group(group_id, portfolios) 4422 4423 4424def deletePortfolioGroup( 4425 apikey: str, 4426 group_id: str, 4427 proxy: Optional[str] = None, 4428 disable_verify_ssl: bool = False, 4429) -> Dict: 4430 """ 4431 Delete a portfolio group 4432 4433 Parameters 4434 ---------- 4435 4436 apikey: str 4437 API key provided by Boosted. This key should be protected as a secret. 4438 4439 group_id: str, 4440 UUID str identifying a portfolio group 4441 4442 proxy: str 4443 Your organization may require the use of a proxy for access. 4444 The address of a HTTPS proxy in the format of <address>:<port>. 4445 Examples are "123.456.789:123" or "my.proxy.com:123". 4446 Do not prepend with "https://". 4447 disable_verify_ssl: bool 4448 Your networking setup may be behind a firewall which performs SSL 4449 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4450 to point to the location of a custom certificate bundle, or set this 4451 parameter to true to disable SSL verification as a workaround. 4452 4453 Returns 4454 ------- 4455 4456 Dict { 4457 removed_groups: int 4458 number of successful changes 4459 4460 removed_portfolios: int 4461 number of successful changes 4462 } 4463 4464 """ 4465 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4466 return client.delete_portfolio_group(group_id) 4467 4468 4469def getRiskGroups( 4470 apikey: str, 4471 model_id: str, 4472 portfolio_id: str, 4473 date: BoostedDate = datetime.date.today(), 4474 proxy: Optional[str] = None, 4475 disable_verify_ssl: bool = False, 4476 use_v2: bool = False, 4477) -> List[Dict[str, Any]]: 4478 """ 4479 Given a model and portfolio, returns the calculated semantic risk groups. 4480 4481 Parameters 4482 ---------- 4483 apikey: str 4484 API key provided by Boosted. This key should be protected as a secret. 4485 model_id: str 4486 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4487 button next to your model's name in the Model Summary Page in Boosted 4488 Insights. 4489 portfolio_id: str 4490 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4491 date: datetime.date | str 4492 Date for which to fetch data. Defaults to "today". 4493 use_v2: bool 4494 Whether to use the "V2" version of risk factors data. 4495 proxy: str 4496 Your organization may require the use of a proxy for access. 4497 The address of a HTTPS proxy in the format of <address>:<port>. 4498 Examples are "123.456.789:123" or "my.proxy.com:123". 4499 Do not prepend with "https://". 4500 disable_verify_ssl: bool 4501 Your networking setup may be behind a firewall which performs SSL 4502 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4503 to point to the location of a custom certificate bundle, or set this 4504 parameter to true to disable SSL verification as a workaround. 4505 4506 Returns 4507 ------- 4508 A list of dictionaries. Each dictionary has the following keys: 4509 machine: int 4510 E.g. 1 for "machine_1", 2 for "machine_2", etc. 4511 risk_group_a: List[str] 4512 List of stock descriptors risk group a (e.g. Cruises, Airlines, etc.) 4513 risk_group_b: List[str] 4514 List of stock descriptors risk group b (e.g. Cruises, Airlines, etc.) 4515 volatility_explained: float 4516 Decimal between 0.0 and 1.0 that represents the percent of stock 4517 universe volatility explained by these groups. 4518 """ 4519 date = convert_date(date) 4520 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4521 return client.get_risk_groups(model_id, portfolio_id, date, use_v2) 4522 4523 4524def getRiskFactorsDiscoveredDescriptors( 4525 apikey: str, 4526 model_id: str, 4527 portfolio_id: str, 4528 date: BoostedDate = datetime.date.today(), 4529 proxy: Optional[str] = None, 4530 disable_verify_ssl: bool = False, 4531 use_v2: bool = False, 4532) -> pd.DataFrame: 4533 """ 4534 Given a model and portfolio, returns the calculated semantic risk discovered 4535 descriptors. 4536 4537 Parameters 4538 ---------- 4539 apikey: str 4540 API key provided by Boosted. This key should be protected as a secret. 4541 model_id: str 4542 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4543 button next to your model's name in the Model Summary Page in Boosted 4544 Insights. 4545 portfolio_id: str 4546 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4547 date: datetime.date | str 4548 Date for which to fetch data. Defaults to "today". 4549 use_v2: bool 4550 Whether to use the "V2" version of risk factors data. 4551 proxy: str 4552 Your organization may require the use of a proxy for access. 4553 The address of a HTTPS proxy in the format of <address>:<port>. 4554 Examples are "123.456.789:123" or "my.proxy.com:123". 4555 Do not prepend with "https://". 4556 disable_verify_ssl: bool 4557 Your networking setup may be behind a firewall which performs SSL 4558 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4559 to point to the location of a custom certificate bundle, or set this 4560 parameter to true to disable SSL verification as a workaround. 4561 4562 Returns 4563 ------- 4564 A dataframe with the following columns: 4565 4566 level: int 4567 An integer indicating the depth/level of that row (0 for sectors, 1 for 4568 securities). 4569 identifier: str 4570 Sector/security identifier. 4571 stock_count: int 4572 Total number of stocks in the sector/industry. For security rows, will 4573 be 1. 4574 volatility: float 4575 exposure: float 4576 rating: float 4577 rating_delta: float 4578 """ 4579 date = convert_date(date) 4580 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4581 return client.get_risk_factors_discovered_descriptors(model_id, portfolio_id, date, use_v2) 4582 4583 4584def getRiskFactorsSectors( 4585 apikey: str, 4586 model_id: str, 4587 portfolio_id: str, 4588 date: BoostedDate = datetime.date.today(), 4589 proxy: Optional[str] = None, 4590 disable_verify_ssl: bool = False, 4591 use_v2: bool = False, 4592) -> pd.DataFrame: 4593 """ 4594 Given a model and portfolio, returns the calculated semantic risk sectors. 4595 4596 Parameters 4597 ---------- 4598 apikey: str 4599 API key provided by Boosted. This key should be protected as a secret. 4600 model_id: str 4601 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4602 button next to your model's name in the Model Summary Page in Boosted 4603 Insights. 4604 portfolio_id: str 4605 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4606 date: datetime.date | str 4607 Date for which to fetch data. Defaults to "today". 4608 use_v2: bool 4609 Whether to use the "V2" version of risk factors data. 4610 proxy: str 4611 Your organization may require the use of a proxy for access. 4612 The address of a HTTPS proxy in the format of <address>:<port>. 4613 Examples are "123.456.789:123" or "my.proxy.com:123". 4614 Do not prepend with "https://". 4615 disable_verify_ssl: bool 4616 Your networking setup may be behind a firewall which performs SSL 4617 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4618 to point to the location of a custom certificate bundle, or set this 4619 parameter to true to disable SSL verification as a workaround. 4620 4621 Returns 4622 ------- 4623 A dataframe with the following columns: 4624 4625 level: int 4626 An integer indicating the depth/level of that row (0 for sectors, 1 for 4627 industry groups, 2 for industries). 4628 identifier: str 4629 Sector/Industry group/Industry identifier. 4630 stock_count: int 4631 Total number of stocks in the sector/industry. 4632 volatility: float 4633 exposure: float 4634 rating: float 4635 rating_delta: float 4636 """ 4637 date = convert_date(date) 4638 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4639 return client.get_risk_factors_sectors(model_id, portfolio_id, date, use_v2) 4640 4641 4642def downloadCompletePortfolioData( 4643 apikey: str, 4644 model_id: str, 4645 portfolio_id: str, 4646 download_filepath: Optional[str] = None, 4647 proxy: Optional[str] = None, 4648 disable_verify_ssl: bool = False, 4649): 4650 """ 4651 Given a model and portfolio, downloads the complete portfolio data as an 4652 excel file to the specified download path. 4653 4654 Parameters 4655 ---------- 4656 apikey: str 4657 API key provided by Boosted. This key should be protected as a secret. 4658 model_id: str 4659 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4660 button next to your model's name in the Model Summary Page in Boosted 4661 Insights. 4662 portfolio_id: str 4663 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4664 download_filepath: Optional[str] 4665 File path to download model data file to. If not present, will default 4666 to a file named after the model_id in the current directory. 4667 proxy: str 4668 Your organization may require the use of a proxy for access. 4669 The address of a HTTPS proxy in the format of <address>:<port>. 4670 Examples are "123.456.789:123" or "my.proxy.com:123". 4671 Do not prepend with "https://". 4672 disable_verify_ssl: bool 4673 Your networking setup may be behind a firewall which performs SSL 4674 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4675 to point to the location of a custom certificate bundle, or set this 4676 parameter to true to disable SSL verification as a workaround. 4677 """ 4678 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4679 if download_filepath is None: 4680 download_filepath = f"{model_id}.xlsx" 4681 client.download_complete_portfolio_data(model_id, portfolio_id, download_filepath) 4682 4683 4684def diffHedgeExperimentPortfolioData( 4685 apikey: str, 4686 experiment_id: str, 4687 comparison_portfolios: List[str], 4688 categories: Optional[List[str]] = None, 4689 proxy: Optional[str] = None, 4690 disable_verify_ssl: bool = False, 4691) -> Dict: 4692 """ 4693 Differences portfolios, returning data relative to the baseline. 4694 4695 This function supports differencing multiple portfolios against the 4696 baseline, such that diff_i = cmp_pf_i - baseline. Differences are 4697 calculated element-wise on a per-category basis. 4698 4699 Currently, this function only works for hedge experiment portfolios. 4700 4701 Parameters 4702 ---------- 4703 apikey: str 4704 API key provided by Boosted. This key should be protected as a secret. 4705 experiment_id: str 4706 Hedge experiment id 4707 comparison_portfolios: List[str] 4708 List of portfolios to be diffed against the current baseline. 4709 categories: List[str] 4710 Specifier of what data to difference. Passing a smaller, desired 4711 subset can improve performance. Options include: 4712 ["performanceGrid", "performance", "factors", "volatility"] 4713 proxy: str 4714 Your organization may require the use of a proxy for access. 4715 The address of a HTTPS proxy in the format of <address>:<port>. 4716 Examples are "123.456.789:123" or "my.proxy.com:123". 4717 Do not prepend with "https://". 4718 disable_verify_ssl: bool 4719 Your networking setup may be behind a firewall which performs SSL 4720 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4721 to point to the location of a custom certificate bundle, or set this 4722 parameter to true to disable SSL verification as a workaround. 4723 4724 Returns 4725 ------- 4726 Dictionary: 4727 { 4728 "factors": Optional[pd.DataFrame], 4729 "volatility":Optional[pd.DataFrame], 4730 "performance": Optional[pd.DataFrame], 4731 "performanceGrid": Optional[pd.DataFrame] 4732 } 4733 """ 4734 4735 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4736 DIFF_CATEGORIES = ["performance", "performanceGrid", "volatility", "factors"] 4737 if categories is None: 4738 categories = DIFF_CATEGORIES 4739 else: 4740 for cat in categories: 4741 if cat not in DIFF_CATEGORIES: 4742 raise ValueError(f"Unexpected category {cat}") 4743 diff = client.diff_hedge_experiment_portfolio_data( 4744 experiment_id, comparison_portfolios, categories 4745 ) 4746 return diff 4747 4748 4749def getSignalStrength( 4750 apikey: str, 4751 model_id: str, 4752 portfolio_id: str, 4753 proxy: Optional[str] = None, 4754 disable_verify_ssl: bool = False, 4755) -> pd.DataFrame: 4756 """ 4757 Retrieves portfolio signals data and returns as a pandas dataframe. 4758 4759 Parameters 4760 ---------- 4761 apikey: str 4762 API key provided by Boosted. This key should be protected as a secret. 4763 model_id: str 4764 UUID of a Boosted model. 4765 portfolio_id: str 4766 UUID of a Boosted portfolio in the given model. 4767 proxy: str 4768 Your organization may require the use of a proxy for access. 4769 The address of a HTTPS proxy in the format of <address>:<port>. 4770 Examples are "123.456.789:123" or "my.proxy.com:123". 4771 Do not prepend with "https://". 4772 disable_verify_ssl: bool 4773 Your networking setup may be behind a firewall which performs SSL 4774 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4775 to point to the location of a custom certificate bundle, or set this 4776 parameter to true to disable SSL verification as a workaround. 4777 4778 Returns 4779 ------- 4780 Pandas Dataframe indexed by date with columns: 4781 5D, 10D, 21D, 63D, 126D, 189D, 252D, 315D, 378D, 441D, 504D, TimeHorizon 4782 """ 4783 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4784 return client.get_signal_strength(model_id, portfolio_id) 4785 4786 4787def getRollingSignalStrength( 4788 apikey: str, 4789 model_id: str, 4790 portfolio_id: str, 4791 proxy: Optional[str] = None, 4792 disable_verify_ssl: bool = False, 4793): 4794 """ 4795 Retrieves portfolio rolling signals data and returns as a pandas dataframe. 4796 4797 Parameters 4798 ---------- 4799 apikey: str 4800 API key provided by Boosted. This key should be protected as a secret. 4801 model_id: str 4802 UUID of a Boosted model. 4803 portfolio_id: str 4804 UUID of a Boosted portfolio in the given model. 4805 proxy: str 4806 Your organization may require the use of a proxy for access. 4807 The address of a HTTPS proxy in the format of <address>:<port>. 4808 Examples are "123.456.789:123" or "my.proxy.com:123". 4809 Do not prepend with "https://". 4810 disable_verify_ssl: bool 4811 Your networking setup may be behind a firewall which performs SSL 4812 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4813 to point to the location of a custom certificate bundle, or set this 4814 parameter to true to disable SSL verification as a workaround. 4815 4816 Returns 4817 ------- 4818 Pandas Dataframe indexed by date with columns: 4819 Avg5D 4820 Avg10D 4821 Avg21D 4822 Avg63D 4823 Avg126D 4824 Avg189D 4825 Avg252D 4826 Avg315D 4827 Avg378D 4828 Avg441D 4829 Avg504D 4830 Avgtime Horizon 4831 """ 4832 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4833 return client.get_rolling_signal_strength(model_id, portfolio_id) 4834 4835 4836def getPortfolioFactorAttribution( 4837 apikey: str, 4838 portfolio_id: str, 4839 start_date: Optional[BoostedDate] = None, 4840 end_date: Optional[BoostedDate] = None, 4841 proxy: Optional[str] = None, 4842 disable_verify_ssl: bool = False, 4843): 4844 """Get factor attribution for a portfolio. 4845 Factor attribution is the methodology of using a stock or strategy’s 4846 factor exposure to explain its risk and reward. 4847 4848 Patameters 4849 ---------- 4850 apikey: str : 4851 API key provided by Boosted. This key should be protected as a secret. 4852 portfolio_id: str 4853 UUID of a Boosted portfolio in the given model. 4854 start_date: datetime.date | str 4855 Starting date for which trades should be fetched. 4856 Default to the first date of the portfolio. 4857 end_date: datetime.date | str 4858 Ending date for which trades should be fetched. 4859 Default to the latest date of the portfolio. 4860 proxy: str 4861 Your organization may require the use of a proxy for access. 4862 The address of a HTTPS proxy in the format of <address>:<port>. 4863 Examples are "123.456.789:123" or "my.proxy.com:123". 4864 Do not prepend with "https://". 4865 disable_verify_ssl: bool 4866 Your networking setup may be behind a firewall which performs SSL 4867 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4868 to point to the location of a custom certificate bundle, or set this 4869 parameter to true to disable SSL verification as a workaround. 4870 4871 Returns 4872 ------- 4873 A Pandas Dataframe indexed by date with each factor attribution per column. 4874 The <factor attribution>_return columns are percentages. 4875 For example, 0.05 of `volatility_return` means the return for volatility is 0.05%. 4876 """ 4877 client = BoostedClient(api_key=apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4878 return client.get_portfolio_factor_attribution( 4879 portfolio_id=portfolio_id, 4880 start_date=start_date, 4881 end_date=end_date, 4882 ) 4883 4884 4885def getPortfolioQuantiles( 4886 apikey: str, 4887 model_id: str, 4888 portfolio_id: str, 4889 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4890 proxy: Optional[str] = None, 4891 disable_verify_ssl: bool = False, 4892): 4893 """ 4894 Get quantile data for a portfolio. 4895 4896 Parameters 4897 ---------- 4898 apikey: str 4899 API key provided by Boosted. This key should be protected as a secret. 4900 model_id: str 4901 UUID of a Boosted model. 4902 portfolio_id: str 4903 UUID of a Boosted portfolio in the given model. 4904 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4905 Whether the column names are ISIN's or tickers in the output dataframe. 4906 proxy: str 4907 Your organization may require the use of a proxy for access. 4908 The address of a HTTPS proxy in the format of <address>:<port>. 4909 Examples are "123.456.789:123" or "my.proxy.com:123". 4910 Do not prepend with "https://". 4911 disable_verify_ssl: bool 4912 Your networking setup may be behind a firewall which performs SSL 4913 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4914 to point to the location of a custom certificate bundle, or set this 4915 parameter to true to disable SSL verification as a workaround. 4916 4917 Returns 4918 ------- 4919 Pandas Dataframe indexed by date with each one security per column. 4920 """ 4921 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4922 return client.get_portfolio_quantiles( 4923 model_id=model_id, 4924 portfolio_id=portfolio_id, 4925 id_type=id_type, 4926 ) 4927 4928 4929def getSimilarStocks( 4930 apikey: str, 4931 model_id: str, 4932 portfolio_id: str, 4933 identifiers: List[str], 4934 date: BoostedDate, 4935 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4936 proxy: Optional[str] = None, 4937 disable_verify_ssl: bool = False, 4938 preferred_country: Optional[str] = None, 4939 preferred_currency: Optional[str] = None, 4940) -> pd.DataFrame: 4941 """ 4942 Get the stock similarity data for a basket of stocks. 4943 4944 Parameters 4945 ---------- 4946 apikey: str 4947 API key provided by Boosted. This key should be protected as a secret. 4948 model_id: str 4949 UUID of a Boosted model. 4950 portfolio_id: str 4951 UUID of a Boosted portfolio in the given model. 4952 identifiers: List[str] 4953 List of identifiers that represent the input basket of stocks, can be 4954 either ISIN's or Tickers. 4955 date: Optional[datetime.date | str] 4956 Date for which similarity data should be fetched. 4957 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4958 Should be set to whatever identifier type is input. Defaults to TICKER. 4959 preferred_country: str 4960 The preferred country for the identifier list, to resolve 4961 abiguities. Should be a 3 character iso code. By default, will try to 4962 figure out the best match. 4963 preferred_currency: str 4964 The preferred currency for the identifier list, to resolve 4965 abiguities. Should be a 3 character iso code. By default, will try to 4966 figure out the best match. 4967 proxy: str 4968 Your organization may require the use of a proxy for access. 4969 The address of a HTTPS proxy in the format of <address>:<port>. 4970 Examples are "123.456.789:123" or "my.proxy.com:123". 4971 Do not prepend with "https://". 4972 disable_verify_ssl: bool 4973 Your networking setup may be behind a firewall which performs SSL 4974 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4975 to point to the location of a custom certificate bundle, or set this 4976 parameter to true to disable SSL verification as a workaround. 4977 4978 Returns 4979 ------- 4980 Pandas Dataframe indexed by identifier with a row for every security in the 4981 portfolio (except for those in the input basket). DataFrame will contain 4982 columns: 4983 - overallSimilarityScore: float 4984 - priceSimilarityScore: float 4985 - factorSimilarityScore: float 4986 - correlation: float 4987 """ 4988 4989 if identifier_type not in ["TICKER", "ISIN"]: 4990 raise ValueError( 4991 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4992 ) 4993 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4994 return client.get_similar_stocks( 4995 model_id=model_id, 4996 portfolio_id=portfolio_id, 4997 symbol_list=identifiers, 4998 date=date, 4999 identifier_type=identifier_type, 5000 preferred_country=preferred_country, 5001 preferred_currency=preferred_currency, 5002 ) 5003 5004 5005def getPortfolioTrades( 5006 apikey: str, 5007 model_id: str, 5008 portfolio_id: str, 5009 start_date: Optional[BoostedDate] = None, 5010 end_date: Optional[BoostedDate] = None, 5011 proxy: Optional[str] = None, 5012 disable_verify_ssl: bool = False, 5013) -> pd.DataFrame: 5014 """ 5015 Get the list of trades for a portfolio. NOTE: The max date range is 7 years, 5016 any larger will return an error. 5017 5018 Parameters 5019 ---------- 5020 apikey: str 5021 API key provided by Boosted. This key should be protected as a secret. 5022 model_id: str 5023 UUID of a Boosted model. 5024 portfolio_id: str 5025 UUID of a Boosted portfolio in the given model. 5026 start_date: Optional[datetime.date | str] 5027 Starting date for which trades should be fetched. 5028 end_date: Optional[datetime.date | str] 5029 Ending date for which trades should be fetched. 5030 proxy: str 5031 Your organization may require the use of a proxy for access. 5032 The address of a HTTPS proxy in the format of <address>:<port>. 5033 Examples are "123.456.789:123" or "my.proxy.com:123". 5034 Do not prepend with "https://". 5035 disable_verify_ssl: bool 5036 Your networking setup may be behind a firewall which performs SSL 5037 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5038 to point to the location of a custom certificate bundle, or set this 5039 parameter to true to disable SSL verification as a workaround. 5040 5041 Returns 5042 ------- 5043 Pandas Dataframe, each row containing data for a security + date. 5044 Columns are: 5045 - isin: str 5046 - ticker: str 5047 - date: datetime.date 5048 - price: float 5049 - shares_owned: float 5050 - shares_traded: float 5051 """ 5052 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5053 return client.get_portfolio_trades( 5054 model_id=model_id, 5055 portfolio_id=portfolio_id, 5056 start_date=start_date, 5057 end_date=end_date, 5058 ) 5059 5060 5061def getIdeas( 5062 apikey: str, 5063 model_id: str, 5064 portfolio_id: str, 5065 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5066 delta_horizon: Literal["1M", "3M", "6M", "9M", "1Y"] = "1M", 5067 proxy: Optional[str] = None, 5068 disable_verify_ssl: bool = False, 5069) -> pd.DataFrame: 5070 """ 5071 Given a model ID, portfolio ID, and a time horizon, return a dataframe of 5072 stock ideas. 5073 5074 Parameters 5075 ---------- 5076 apikey: str 5077 API key provided by Boosted. This key should be protected as a secret. 5078 model_id: str 5079 UUID of a Boosted model. 5080 portfolio_id: str 5081 UUID of a Boosted portfolio in the given model. 5082 investment_horizon: str 5083 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5084 delta_horizon: str 5085 Time period over which to compute deltas. Can be "1M", "3M", "6M", "9M", "1Y". 5086 proxy: str 5087 Your organization may require the use of a proxy for access. 5088 The address of a HTTPS proxy in the format of <address>:<port>. 5089 Examples are "123.456.789:123" or "my.proxy.com:123". 5090 Do not prepend with "https://". 5091 disable_verify_ssl: bool 5092 Your networking setup may be behind a firewall which performs SSL 5093 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5094 to point to the location of a custom certificate bundle, or set this 5095 parameter to true to disable SSL verification as a workaround. 5096 5097 Returns 5098 ------- 5099 Pandas Dataframe, each row containing data for a security. The dataframe is 5100 indexed by ticker. 5101 Columns are: 5102 - recommendation: str 5103 - rating: float 5104 - rating_delta: float 5105 - dividend_yield: float 5106 - predicted_excess_return_1m: float 5107 - predicted_excess_return_3m: float 5108 - predicted_excess_return_1y: float 5109 - risk: str 5110 - reward: str 5111 - reason: str 5112 """ 5113 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5114 return client.get_ideas( 5115 model_id=model_id, 5116 portfolio_id=portfolio_id, 5117 investment_horizon=investment_horizon, 5118 delta_horizon=delta_horizon, 5119 ) 5120 5121 5122def getStockRecommendations( 5123 apikey: str, 5124 model_id: str, 5125 portfolio_id: str, 5126 symbols: Optional[List[str]] = None, 5127 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5128 proxy: Optional[str] = None, 5129 disable_verify_ssl: bool = False, 5130) -> pd.DataFrame: 5131 """ 5132 Given a model ID, portfolio ID, optional list of symbols, and a time 5133 horizon, return a dictionary of symbols to stock recommendations. 5134 5135 Parameters 5136 ---------- 5137 apikey: str 5138 API key provided by Boosted. This key should be protected as a secret. 5139 model_id: str 5140 UUID of a Boosted model. 5141 portfolio_id: str 5142 UUID of a Boosted portfolio in the given model. 5143 symbols: Optional[List[str]] 5144 List of symbols for which to fetch recommendation info. If None, will 5145 return recommendations for the entire portfolio. Note that invalid 5146 symbols or symbols without recommendations will not be returned. 5147 investment_horizon: str 5148 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5149 proxy: str 5150 Your organization may require the use of a proxy for access. 5151 The address of a HTTPS proxy in the format of <address>:<port>. 5152 Examples are "123.456.789:123" or "my.proxy.com:123". 5153 Do not prepend with "https://". 5154 disable_verify_ssl: bool 5155 Your networking setup may be behind a firewall which performs SSL 5156 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5157 to point to the location of a custom certificate bundle, or set this 5158 parameter to true to disable SSL verification as a workaround. 5159 5160 Returns 5161 ------- 5162 Pandas Dataframe, each row containing data for a security. The dataframe is 5163 indexed by ticker. The "reasons" column is a dict from a reason's "title" to 5164 its text. 5165 Columns are: 5166 - recommendation: str 5167 - predicted_excess_return_1m: float 5168 - predicted_excess_return_3m: float 5169 - predicted_excess_return_1y: float 5170 - risk: str 5171 - reward: str 5172 - reasons: Dict[str, str] 5173 """ 5174 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5175 return client.get_stock_recommendations( 5176 model_id=model_id, 5177 portfolio_id=portfolio_id, 5178 symbols=symbols, 5179 investment_horizon=investment_horizon, 5180 ) 5181 5182 5183def getStockRecommendationReasons( 5184 apikey: str, 5185 model_id: str, 5186 portfolio_id: str, 5187 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5188 symbols: Optional[List[str]] = None, 5189 proxy: Optional[str] = None, 5190 disable_verify_ssl: bool = False, 5191) -> Dict[str, Optional[List[str]]]: 5192 """ 5193 Given a model ID, portfolio ID, symbols, and a time horizon, return a dictionary 5194 of symbols to stock recommendations. 5195 5196 Parameters 5197 ---------- 5198 apikey: str 5199 API key provided by Boosted. This key should be protected as a secret. 5200 model_id: str 5201 UUID of a Boosted model. 5202 portfolio_id: str 5203 UUID of a Boosted portfolio in the given model. 5204 symbols: List[str] 5205 Optional list of symbols for which to fetch reasons. If None, all symbols 5206 for the given portfolio are fetched. 5207 investment_horizon: str 5208 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5209 proxy: str 5210 Your organization may require the use of a proxy for access. 5211 The address of a HTTPS proxy in the format of <address>:<port>. 5212 Examples are "123.456.789:123" or "my.proxy.com:123". 5213 Do not prepend with "https://". 5214 disable_verify_ssl: bool 5215 Your networking setup may be behind a firewall which performs SSL 5216 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5217 to point to the location of a custom certificate bundle, or set this 5218 parameter to true to disable SSL verification as a workaround. 5219 5220 Returns 5221 ------- 5222 Dictionary: 5223 { 5224 <symbol_0>: [reason_0, reason_1, ...], 5225 <symbol_1>: [reason_0, reason_1, ...] 5226 } 5227 Note that for a passed symbol that has no reasons, the symbol will be present 5228 in the dictionary but will not have any elements in its list, i.e. 5229 >>> print(result["SOME_SYMBOL_WITH_NO_REASONS"]) 5230 [] 5231 Additionally, if a passed symbol is not found as a portfolio holding, the symbol 5232 will be present in the dictionary but will be valued None, i.e. 5233 >>> print(result["SOME_SYMBOL_NOT_FOUND"]) 5234 None 5235 """ 5236 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5237 return client.get_stock_recommendation_reasons( 5238 model_id=model_id, 5239 portfolio_id=portfolio_id, 5240 investment_horizon=investment_horizon, 5241 symbols=symbols, 5242 ) 5243 5244 5245def get_stock_mapping_alternatives( 5246 self, 5247 apikey: str, 5248 isin: Optional[str] = None, 5249 symbol: Optional[str] = None, 5250 country: Optional[str] = None, 5251 currency: Optional[str] = None, 5252 asof_date: Optional[BoostedDate] = None, 5253 proxy: Optional[str] = None, 5254 disable_verify_ssl: bool = False, 5255) -> Dict: 5256 """ 5257 Return the stock mapping for the given criteria, 5258 also suggestions for alternate matches, 5259 if the mapping is not what is wanted 5260 5261 Parameters [One of either ISIN or SYMBOL must be provided] 5262 ---------- 5263 isin: Optional[str] 5264 search by ISIN 5265 symbol: Optional[str] 5266 search by Ticker Symbol 5267 country: Optional[str] 5268 Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" 5269 currency: Optional[str] 5270 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5271 asof_date: Optional[date] 5272 as of which date to perform the search, default is today() 5273 5274 Note: country/currency filter starting with "p_" indicates 5275 only a soft preference but allows other matches 5276 5277 Returns 5278 ------- 5279 Dictionary Representing this 'MapSecurityResponse' structure: 5280 5281 class MapSecurityResponse(): 5282 stock_mapping: Optional[SecurityInfo] 5283 The mapping we would perform given your inputs 5284 5285 alternatives: Optional[List[SecurityInfo]] 5286 Alternative suggestions based on your input 5287 5288 error: Optional[str] 5289 5290 class SecurityInfo(): 5291 gbi_id: int 5292 isin: str 5293 symbol: Optional[str] 5294 country: str 5295 currency: str 5296 name: str 5297 from_date: date 5298 to_date: date 5299 is_primary_trading_item: bool 5300 5301 """ 5302 5303 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5304 return client.get_stock_mapping_alternatives( 5305 isin=isin, symbol=symbol, country=country, currency=currency, asof_date=asof_date 5306 ) 5307 5308 5309def getProsConsForStocks( 5310 apikey: str, 5311 model_id: Optional[str] = None, 5312 symbols: Optional[List[str]] = None, 5313 preferred_country: Optional[str] = None, 5314 preferred_currency: Optional[str] = None, 5315 proxy: Optional[str] = None, 5316 disable_verify_ssl: bool = False, 5317) -> Dict[str, Dict[str, List]]: 5318 """ 5319 Given a model ID OR a list of symbols, return pros/cons for 5320 each stock. Note that unrecognized symbols will be absent from the output. 5321 5322 Parameters 5323 ---------- 5324 apikey: str 5325 API key provided by Boosted. This key should be protected as a secret. 5326 model_id: Optional[str] 5327 UUID of a Boosted model. 5328 symbols: Optional[List[str]] 5329 List of symbols for which to fetch pros/cons. 5330 preferred_country: str 5331 The preferred country for the identifier list, to resolve 5332 abiguities. Should be a 3 character iso code. By default, will try to 5333 figure out the best match. 5334 preferred_currency: str 5335 The preferred currency for the identifier list, to resolve 5336 abiguities. Should be a 3 character iso code. By default, will try to 5337 figure out the best match. 5338 proxy: str 5339 Your organization may require the use of a proxy for access. 5340 The address of a HTTPS proxy in the format of <address>:<port>. 5341 Examples are "123.456.789:123" or "my.proxy.com:123". 5342 Do not prepend with "https://". 5343 disable_verify_ssl: bool 5344 Your networking setup may be behind a firewall which performs SSL 5345 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5346 to point to the location of a custom certificate bundle, or set this 5347 parameter to true to disable SSL verification as a workaround. 5348 5349 Returns 5350 ------- 5351 Dictionary in the following format 5352 { "SYMBOL": 5353 { 5354 "pros": [ 5355 { 5356 "summary": "Increase in service revenue", 5357 "details": "Details..." 5358 }, 5359 ], 5360 "cons": [ 5361 { 5362 "summary": "Increase in cost of vehicle sales", 5363 "details": "Details..." 5364 }, 5365 ] 5366 } 5367 } 5368 """ 5369 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5370 if symbols is None and model_id is None: 5371 raise BoostedAPIException("Must provide either a list of symbols or a model/portfolio") 5372 return client.get_pros_cons_for_stocks( 5373 symbols=symbols, 5374 model_id=model_id, 5375 preferred_country=preferred_country, 5376 preferred_currency=preferred_currency, 5377 ) 5378 5379 5380####################################################################### 5381# NLP 5382####################################################################### 5383def generateTheme( 5384 apikey: str, 5385 theme_name: str, 5386 stock_universes: List[ThemeUniverse], 5387 proxy: Optional[str] = None, 5388 disable_verify_ssl: bool = False, 5389) -> str: 5390 """ 5391 The API to generate a theme for a list of stock universes. 5392 5393 Parameters 5394 ---------- 5395 apikey: str 5396 API key provided by Boosted. This key should be protected as a secret. 5397 theme_name: str 5398 The name of the theme to generate. 5399 stock_universes: List[ThemeUniverse] 5400 The universe of stocks to use for the theme. We currently support the universes in the enum 5401 class `ThemeUniverse`. 5402 proxy: str 5403 Your organization may require the use of a proxy for access. 5404 The address of a HTTPS proxy in the format of <address>:<port>. 5405 Examples are "123.456.789:123" or "my.proxy.com:123". 5406 Do not prepend with "https://". 5407 disable_verify_ssl: bool 5408 Your networking setup may be behind a firewall which performs SSL 5409 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5410 to point to the location of a custom certificate bundle, or set this 5411 parameter to true to disable SSL verification as a workaround. 5412 5413 Returns 5414 ------- 5415 a string of theme id that can be used to query the theme data later. 5416 """ 5417 if not stock_universes: 5418 raise BoostedAPIException("Must provide a list of stock universe IDs") 5419 5420 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5421 return client.generate_theme(theme_name, stock_universes) 5422 5423 5424def getThemesForStock( 5425 apikey: str, 5426 isin: str, 5427 currency: Optional[str] = None, 5428 country: Optional[str] = None, 5429 start_date: Optional[BoostedDate] = None, 5430 end_date: Optional[BoostedDate] = None, 5431 language: Optional[Union[str, Language]] = None, 5432 proxy: Optional[str] = None, 5433 disable_verify_ssl: bool = False, 5434) -> List[Dict]: 5435 """ 5436 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5437 5438 Parameters 5439 ---------- 5440 apikey: str 5441 API key provided by Boosted. This key should be protected as a secret. 5442 isin: str 5443 The ISIN of the stock to get themes for. 5444 currency: Optional[str] 5445 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5446 "ANY", "p_USA", "CAN" 5447 country: Optional[str] 5448 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5449 start_date & end_date: Optional[BoostedDate] 5450 The start and end date to calculate the theme importance. If not provided, the default is 5451 the past 30 days. 5452 language: Optional[str | Language] 5453 Will translate AI generated text into the given language. This may be a 5454 language in the Language enum or any language code supported by Google 5455 Translate. 5456 proxy: str 5457 Your organization may require the use of a proxy for access. 5458 The address of a HTTPS proxy in the format of <address>:<port>. 5459 Examples are "123.456.789:123" or "my.proxy.com:123". 5460 Do not prepend with "https://". 5461 disable_verify_ssl: bool 5462 Your networking setup may be behind a firewall which performs SSL 5463 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5464 to point to the location of a custom certificate bundle, or set this 5465 parameter to true to disable SSL verification as a workaround. 5466 5467 Returns 5468 ------- 5469 A list of below dictionaries 5470 { 5471 themeId: str 5472 themeName: str 5473 importanceScore: float 5474 similarityScore: float 5475 positiveThemeRelation: bool 5476 reason: String 5477 } 5478 """ 5479 if (start_date and not end_date) or (end_date and not start_date): 5480 raise BoostedAPIException("Must provide both start and end dates or neither") 5481 5482 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5483 return client.get_themes_for_stock(isin, currency, country, start_date, end_date, language) 5484 5485 5486def getThemesForStockUniverse( 5487 apikey: str, 5488 stock_universe: ThemeUniverse, 5489 start_date: Optional[BoostedDate] = None, 5490 end_date: Optional[BoostedDate] = None, 5491 language: Optional[Union[str, Language]] = None, 5492 proxy: Optional[str] = None, 5493 disable_verify_ssl: bool = False, 5494) -> List[Dict]: 5495 """ 5496 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5497 5498 Parameters 5499 ---------- 5500 apikey: str 5501 API key provided by Boosted. This key should be protected as a secret. 5502 stock_universe: ThemeUniverse 5503 The universe of stocks to fetch for themes 5504 start_date & end_date: Optional[BoostedDate] 5505 The start and end date to calculate the theme importance. If not provided, the default is 5506 the past 30 days. 5507 language: Optional[str | Language] 5508 Will translate AI generated text into the given language. This may be a 5509 language in the Language enum or any language code supported by Google 5510 Translate. 5511 proxy: str 5512 Your organization may require the use of a proxy for access. 5513 The address of a HTTPS proxy in the format of <address>:<port>. 5514 Examples are "123.456.789:123" or "my.proxy.com:123". 5515 Do not prepend with "https://". 5516 disable_verify_ssl: bool 5517 Your networking setup may be behind a firewall which performs SSL 5518 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5519 to point to the location of a custom certificate bundle, or set this 5520 parameter to true to disable SSL verification as a workaround. 5521 5522 Returns: A list of below dictionaries 5523 ------- 5524 { 5525 themeId: str 5526 themeName: str 5527 themeImportance: float 5528 volatility: float 5529 positiveStockPerformance: float 5530 negativeStockPerformance: float 5531 } 5532 """ 5533 if (start_date and not end_date) or (end_date and not start_date): 5534 raise BoostedAPIException("Must provide both start and end dates or neither") 5535 5536 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5537 return client.get_themes_for_stock_universe(stock_universe, start_date, end_date, language) 5538 5539 5540def getStockNews( 5541 apikey: str, 5542 time_horizon: NewsHorizon, 5543 isin: str, 5544 currency: Optional[str] = None, 5545 country: Optional[str] = None, 5546 language: Optional[Union[str, Language]] = None, 5547 proxy: Optional[str] = None, 5548 disable_verify_ssl: bool = False, 5549) -> Dict: 5550 """ 5551 The API to get a stock's news summary for a given time horizon, the topics summarized by these 5552 news and the corresponding news to these topics 5553 Parameters 5554 ---------- 5555 apikey: str 5556 API key provided by Boosted. This key should be protected as a secret. 5557 time_horizon: NewsHorizon 5558 The time horizon for the company's news, summary, topics 5559 isin: str 5560 The ISIN of the stock to get themes for. 5561 currency: Optional[str] 5562 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5563 "ANY", "p_USA", "CAN" 5564 country: Optional[str] 5565 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5566 language: Optional[str | Language] 5567 Will translate AI generated text into the given language. This may be a 5568 language in the Language enum or any language code supported by Google 5569 Translate. 5570 start_date & end_date: Optional[BoostedDate] 5571 The start and end date to calculate the theme importance. If not provided, the default is 5572 the past 30 days. 5573 proxy: str 5574 Your organization may require the use of a proxy for access. 5575 The address of a HTTPS proxy in the format of <address>:<port>. 5576 Examples are "123.456.789:123" or "my.proxy.com:123". 5577 Do not prepend with "https://". 5578 disable_verify_ssl: bool 5579 Your networking setup may be behind a firewall which performs SSL 5580 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5581 to point to the location of a custom certificate bundle, or set this 5582 parameter to true to disable SSL verification as a workaround. 5583 Returns 5584 ------- 5585 A nested dictionary in the following format: 5586 { 5587 summary: str 5588 topics: [ 5589 { 5590 topicId: str 5591 topicLabel: str 5592 topicDescription: str 5593 topicPolarity: str 5594 newsItems: [ 5595 { 5596 newsId: str 5597 headline: str 5598 url: str 5599 summary: str 5600 source: str 5601 publishedAt: str 5602 } 5603 ] 5604 } 5605 ] 5606 other_news_count: int 5607 } 5608 """ 5609 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5610 return client.get_stock_news(time_horizon, isin, currency, country, language) 5611 5612 5613def getThemeDetails( 5614 apikey: str, 5615 theme_id: str, 5616 universe: ThemeUniverse, 5617 language: Optional[Union[str, Language]] = None, 5618 proxy: Optional[str] = None, 5619 disable_verify_ssl: bool = False, 5620) -> Dict[str, Any]: 5621 """ 5622 Returns detailed theme info for a given theme ID and universe. Theme ID's 5623 can be fetched from the getAllThemeMetadata endpoint. 5624 Parameters 5625 ---------- 5626 apikey: str 5627 API key provided by Boosted. This key should be protected as a secret. 5628 theme_id: str 5629 UUID representing either a boosted theme or a theme owned with the 5630 account associated with the api key. Theme ID's can be fetched from the 5631 getAllThemeMetadata endpoint. 5632 universe: ThemeUniverse 5633 The universe of stocks to use when showing theme details/impacts. 5634 language: Optional[str | Language] 5635 Will translate AI generated text into the given language. This may be a 5636 language in the Language enum or any language code supported by Google 5637 Translate. 5638 proxy: str 5639 Your organization may require the use of a proxy for access. 5640 The address of a HTTPS proxy in the format of <address>:<port>. 5641 Examples are "123.456.789:123" or "my.proxy.com:123". 5642 Do not prepend with "https://". 5643 disable_verify_ssl: bool 5644 Your networking setup may be behind a firewall which performs SSL 5645 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5646 to point to the location of a custom certificate bundle, or set this 5647 parameter to true to disable SSL verification as a workaround. 5648 Returns 5649 ------- 5650 A nested dictionary in the following format: 5651 { 5652 "theme_name": str, 5653 "theme_summary": str, 5654 "impacts": [ 5655 { 5656 "impact_name": str, 5657 "impact_description": str, 5658 "impact_score": float, 5659 "articles": [ 5660 { 5661 "title": str, 5662 "url": str, 5663 "source": str, 5664 "publish_date": str 5665 } 5666 ], 5667 "impact_stocks": [ 5668 { 5669 "isin": str, 5670 "name": str, 5671 "positive_impact_relation": bool 5672 } 5673 ] 5674 } 5675 ], 5676 "stocks": [ 5677 { 5678 "isin": str, 5679 "name": str, 5680 "positive_theme_relation": bool, 5681 "reason": str, 5682 "theme_stock_impact_score": float 5683 } 5684 ], 5685 "developments": [ 5686 { 5687 "name": str, 5688 "article_count": int, 5689 "date": datetime.date, 5690 "description": str, 5691 "is_major_development": bool, 5692 "sentiment": int, (-1, 0, 1) 5693 "news": [ 5694 { 5695 "headline": str, 5696 "published_at": datetime.datetime, 5697 "source": str, 5698 "url": str, 5699 } 5700 ] 5701 } 5702 ] 5703 } 5704 5705 """ 5706 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5707 return client.get_theme_details(theme_id=theme_id, universe=universe, language=language) 5708 5709 5710def getAllThemeMetadata( 5711 apikey: str, 5712 language: Optional[Union[str, Language]] = None, 5713 proxy: Optional[str] = None, 5714 disable_verify_ssl: bool = False, 5715) -> List[Dict[str, Any]]: 5716 """ 5717 Returns metadata about all themes owned by the account associated with the 5718 given API key. 5719 Parameters 5720 ---------- 5721 apikey: str 5722 API key provided by Boosted. This key should be protected as a secret. 5723 language: Optional[str | Language] 5724 Will translate AI generated text into the given language. This may be a 5725 language in the Language enum or any language code supported by Google 5726 Translate. 5727 proxy: str 5728 Your organization may require the use of a proxy for access. 5729 The address of a HTTPS proxy in the format of <address>:<port>. 5730 Examples are "123.456.789:123" or "my.proxy.com:123". 5731 Do not prepend with "https://". 5732 disable_verify_ssl: bool 5733 Your networking setup may be behind a firewall which performs SSL 5734 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5735 to point to the location of a custom certificate bundle, or set this 5736 parameter to true to disable SSL verification as a workaround. 5737 Returns 5738 ------- 5739 A list of dictionaries in the following format: 5740 [ 5741 { 5742 "theme_name": str, 5743 "theme_id": str, 5744 "universes": List[str] 5745 } 5746 ] 5747 5748 """ 5749 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5750 return client.get_all_theme_metadata(language=language) 5751 5752 5753def getEarningsImpactingSecurity( 5754 apikey: str, 5755 isin: str, 5756 currency: Optional[str] = None, 5757 country: Optional[str] = None, 5758 language: Optional[Union[str, Language]] = None, 5759 proxy: Optional[str] = None, 5760 disable_verify_ssl: bool = False, 5761) -> List[Dict[str, Any]]: 5762 """ 5763 Returns upcoming earnings releases that could impact the given security. 5764 Parameters 5765 ---------- 5766 apikey: str 5767 API key provided by Boosted. This key should be protected as a secret. 5768 isin: str 5769 The ISIN of the stock to get themes for. 5770 currency: Optional[str] 5771 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5772 "ANY", "p_USA", "CAN" 5773 country: Optional[str] 5774 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5775 language: Optional[str | Language] 5776 Will translate AI generated text into the given language. This may be a 5777 language in the Language enum or any language code supported by Google 5778 Translate. 5779 start_date & end_date: Optional[BoostedDate] 5780 The start and end date to calculate the theme importance. If not provided, the default is 5781 the past 30 days. 5782 proxy: str 5783 Your organization may require the use of a proxy for access. 5784 The address of a HTTPS proxy in the format of <address>:<port>. 5785 Examples are "123.456.789:123" or "my.proxy.com:123". 5786 Do not prepend with "https://". 5787 disable_verify_ssl: bool 5788 Your networking setup may be behind a firewall which performs SSL 5789 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5790 to point to the location of a custom certificate bundle, or set this 5791 parameter to true to disable SSL verification as a workaround. 5792 Returns 5793 ------- 5794 A list of dictionaries in the following format: 5795 [ 5796 { 5797 "event_date": str, 5798 "company_name": str, 5799 "symbol": str, 5800 "isin": str, 5801 "impact_reason": str 5802 } 5803 ] 5804 5805 """ 5806 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5807 return client.get_earnings_impacting_security( 5808 isin=isin, country=country, currency=currency, language=language 5809 ) 5810 5811 5812def getEarningsInsights( 5813 apikey: str, 5814 isin: str, 5815 currency: Optional[str] = None, 5816 country: Optional[str] = None, 5817 proxy: Optional[str] = None, 5818 disable_verify_ssl: bool = False, 5819) -> Dict[str, Any]: 5820 """ 5821 Returns earnings insights data for a security. This data includes summarized 5822 versions of the two most recent earnings calls, as well as a generated 5823 comparison between them. 5824 Parameters 5825 ---------- 5826 apikey: str 5827 API key provided by Boosted. This key should be protected as a secret. 5828 isin: str 5829 The ISIN of the stock to get earnings data for. 5830 currency: Optional[str] 5831 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5832 "ANY", "p_USA", "CAN" 5833 country: Optional[str] 5834 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5835 proxy: str 5836 Your organization may require the use of a proxy for access. 5837 The address of a HTTPS proxy in the format of <address>:<port>. 5838 Examples are "123.456.789:123" or "my.proxy.com:123". 5839 Do not prepend with "https://". 5840 disable_verify_ssl: bool 5841 Your networking setup may be behind a firewall which performs SSL 5842 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5843 to point to the location of a custom certificate bundle, or set this 5844 parameter to true to disable SSL verification as a workaround. 5845 Returns 5846 ------- 5847 A dictionary in the following format: 5848 { 5849 "earnings_report": 5850 { 5851 "release_date": datetime.date, 5852 "quarter": int, 5853 "year": int, 5854 "details": [ 5855 {"header": str, "detail": str, "sentiment": "str"} 5856 ], 5857 "call_summary": str, 5858 "common_remarks": [ 5859 {"header": str, "detail": str, "sentiment": "str"} 5860 ], 5861 "dropped_remarks": [ 5862 {"header": str, "detail": str, "sentiment": "str"} 5863 ], 5864 "qa_summary": str, 5865 "qa_details": [ 5866 {"header": str, "detail": str, "sentiment": "str"} 5867 ], 5868 }, 5869 "prior_earnings_report": (same as above except dropped_remarks becomes new_remarks), 5870 "report_comparison": [ 5871 {"header": str, "detail": str} 5872 ] 5873 } 5874 """ 5875 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5876 return client.get_earnings_insights_for_stocks(isin=isin, currency=currency, country=country) 5877 5878 5879# i added a comment 5880def getPortfolioInferenceStatus( 5881 apikey: str, 5882 portfolio_id: str, 5883 inference_date: str, 5884 proxy: Optional[str] = None, 5885 disable_verify_ssl: bool = False, 5886) -> Dict[str, Any]: 5887 """ 5888 Returns the live inference status of a portfolio, or the expected finish time if it is 5889 not yet done. 5890 Parameters 5891 ---------- 5892 apikey: str 5893 API key provided by Boosted. This key should be protected as a secret. 5894 portfolio_id: str 5895 The ID of the portfolio. This comes from the URL used to access the portfolio on the screen. 5896 Will be a UUID such as "ffffffff-ffff-ffff-ffff-ffffffffffff" 5897 inference_date: str 5898 YYYY-MM-DD string, such as 2023-09-22 5899 proxy: str 5900 Your organization may require the use of a proxy for access. 5901 The address of a HTTPS proxy in the format of <address>:<port>. 5902 Examples are "123.456.789:123" or "my.proxy.com:123". 5903 Do not prepend with "https://". 5904 disable_verify_ssl: bool 5905 Your networking setup may be behind a firewall which performs SSL 5906 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5907 to point to the location of a custom certificate bundle, or set this 5908 parameter to true to disable SSL verification as a workaround. 5909 Returns 5910 ------- 5911 portfolio_id could be at one of the following stages before completion - 5912 Date Ingestion, Machine Learning 5913 5914 Returns a dictionary in the following format if no stage has 5915 completed for portfolio_id on inference_date: 5916 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": null, "stageDoneAt": null} 5917 5918 Returns a dictionary in one of the following format 5919 if a stage has completed for the portfolio_id on inference_date: 5920 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": "Data Ingestion", 5921 "stageDoneAt": "2024-04-28T11:46:10Z"} 5922 5923 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": "Machine Learning", 5924 "stageDoneAt": "2024-04-28T12:46:10Z"} 5925 5926 5927 Returns a dictionary in the following format if the portfolio_id has completed: 5928 {"expectedFinishTimeUTC": null, "stageDone": "Completed", stageDoneAt: "2024-04-28T12:50:10Z"} 5929 5930 """ 5931 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5932 return client.get_portfolio_inference_status( 5933 portfolio_id=portfolio_id, inference_date=inference_date 5934 ) 5935 5936 5937def deletePortfolios( 5938 apikey: str, model_to_portfolios: Dict[str, List[str]], proxy=None, disable_verify_ssl=False 5939): 5940 """ 5941 Deletes B1 portfolios given model and portfolio IDs. 5942 5943 Parameters 5944 ---------- 5945 apikey: str 5946 API key provided by Boosted. This key should be protected as a secret. 5947 model_to_portfolios: Dict[str, List[str]] 5948 Maps model id to list of associated portfolio ids to delete 5949 proxy: str 5950 Your organization may require the use of a proxy for access. 5951 The address of a HTTPS proxy in the format of <address>:<port>. 5952 Examples are "123.456.789:123" or "my.proxy.com:123". 5953 Do not prepend with "https://". 5954 disable_verify_ssl: bool 5955 Your networking setup may be behind a firewall which performs SSL 5956 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5957 to point to the location of a custom certificate bundle, or set this 5958 parameter to true to disable SSL verification as a workaround. 5959 5960 Returns 5961 ------- 5962 None 5963 """ 5964 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5965 client.delete_portfolios(model_to_portfolios)
35def inferDependentDataSetSchema(name, df, infer_from_column_names=False): 36 """ 37 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 38 39 Parameters 40 ---------- 41 datasetName: str 42 Name for this dataset. 43 df: pandas.DataFrame 44 Pandas DataFrame containing your data. The index must be 45 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 46 infer_from_column_names: bool 47 Allows creation of dataset schemas with more flexible identifier columns. 48 Identifier column names must be specified equal to (case and whitespace insensitive) 49 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 50 together as a block in the first N columns of your dataset, where N is the number of 51 identifiers. 52 53 Returns 54 ------- 55 DatasetConfig 56 A DatasetConfig can be used to create a new dataset. 57 """ 58 return infer_dataset_schema( 59 name, df, DataSetType.STOCK, infer_from_column_names=infer_from_column_names 60 )
Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers.
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
63def inferCustomSecurityDailyDataSetSchema( 64 df, infer_from_column_names=False, schema_name="custom_security_daily" 65): 66 """ 67 Creates a custom security daily schema by inferring the contents from a Pandas DataFrame. 68 69 Parameters 70 ---------- 71 df: pandas.DataFrame 72 Pandas DataFrame containing your data. The index must be 73 DatetimeIndex. The columns must be the identifiers: 74 e.g. (custom_security), followed by any features in the dataset. 75 76 For custom security, we expect at minimum a custom security identifier and 77 a close price. The CSV header should look like this: 78 custom_security,daily_close 79 with support for the following optional pricing data columns in total: 80 daily_open 81 daily_close 82 daily_vwap 83 daily_high 84 daily_low 85 daily_bid 86 daily_ask 87 daily_volume (default high volume) 88 daily_mcap (default high mcap) 89 90 infer_from_column_names: bool 91 Allows creation of dataset schemas with more flexible identifier columns. 92 Identifier column names must be specified equal to (case and whitespace insensitive) 93 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 94 together as a block in the first N columns of your dataset, where N is the number of 95 identifiers. 96 97 Returns 98 ------- 99 DatasetConfig 100 A DatasetConfig can be used to create a new dataset. 101 """ 102 return infer_dataset_schema( 103 schema_name, 104 df, 105 DataSetType.SECURITIES_DAILY, 106 infer_from_column_names=infer_from_column_names, 107 )
Creates a custom security daily schema by inferring the contents from a Pandas DataFrame.
Parameters
df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The columns must be the identifiers: e.g. (custom_security), followed by any features in the dataset.
For custom security, we expect at minimum a custom security identifier and
a close price. The CSV header should look like this:
custom_security,daily_close
with support for the following optional pricing data columns in total:
daily_open
daily_close
daily_vwap
daily_high
daily_low
daily_bid
daily_ask
daily_volume (default high volume)
daily_mcap (default high mcap)
infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers.
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
110def inferDependentHistoricalQuarterlyDataSetSchema( 111 name, df, infer_dataset_report_period=True, infer_from_column_names=False 112): 113 """ 114 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 115 116 Parameters 117 ---------- 118 datasetName: str 119 Name for this dataset. 120 df: pandas.DataFrame 121 Pandas DataFrame containing your data. The index must be 122 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 123 infer_from_column_names: bool 124 Allows creation of dataset schemas with more flexible identifier columns. 125 Identifier column names must be specified equal to (case and whitespace insensitive) 126 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 127 together as a block in the first N columns of your dataset, where N is the number of 128 identifiers. 129 infer_dataset_report_period: bool 130 Allow the report period to be inferred based on the report date 131 132 Returns 133 ------- 134 DatasetConfig 135 A DatasetConfig can be used to create a new dataset. 136 """ 137 return infer_dataset_schema( 138 name, 139 df, 140 DataSetType.STOCK, 141 dataset_subtype=DataSetSubType.SPARSE_HIST, 142 dataset_frequency=DataSetFrequency.QUARTERLY, 143 infer_dataset_report_period=infer_dataset_report_period, 144 infer_from_column_names=infer_from_column_names, 145 )
Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers. infer_dataset_report_period: bool Allow the report period to be inferred based on the report date
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
148def inferDependentForwardQuarterlyDataSetSchema( 149 name, df, infer_dataset_report_period=True, infer_from_column_names=False 150): 151 """ 152 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 153 154 Parameters 155 ---------- 156 datasetName: str 157 Name for this dataset. 158 df: pandas.DataFrame 159 Pandas DataFrame containing your data. The index must be 160 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 161 infer_from_column_names: bool 162 Allows creation of dataset schemas with more flexible identifier columns. 163 Identifier column names must be specified equal to (case and whitespace insensitive) 164 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 165 together as a block in the first N columns of your dataset, where N is the number of 166 identifiers. 167 infer_dataset_report_period: bool 168 Allow the report period to be inferred based on the report date 169 170 Returns 171 ------- 172 DatasetConfig 173 A DatasetConfig can be used to create a new dataset. 174 """ 175 return infer_dataset_schema( 176 name, 177 df, 178 DataSetType.STOCK, 179 dataset_subtype=DataSetSubType.SPARSE_FWD, 180 dataset_frequency=DataSetFrequency.QUARTERLY, 181 infer_dataset_report_period=infer_dataset_report_period, 182 infer_from_column_names=infer_from_column_names, 183 )
Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers. infer_dataset_report_period: bool Allow the report period to be inferred based on the report date
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
186def inferIndependentDataSetSchema(name, df): 187 """ 188 Creates a independent dataset schema by inferring the contents from a Pandas DataFrame. 189 190 Parameters 191 ---------- 192 datasetName: str 193 Name for this dataset. 194 df: pandas.DataFrame 195 Pandas DataFrame containing your data. The index must be 196 DatetimeIndex. The first column must be a unique custom security identifier 197 198 Returns 199 ------- 200 DatasetConfig 201 A DatasetConfig can be used to create a new dataset. 202 """ 203 return infer_dataset_schema(name, df, DataSetType.STRATEGY, infer_from_column_names=False)
Creates a independent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be a unique custom security identifier
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
206def inferGlobalDataSetSchema(name, df): 207 """ 208 Creates a independent dataset schema by inferring the contents from a Pandas DataFrame. 209 210 Parameters 211 ---------- 212 datasetName: str 213 Name for this dataset. 214 df: pandas.DataFrame 215 Pandas DataFrame containing your data. The index must be 216 DatetimeIndex. 217 218 Returns 219 ------- 220 DatasetConfig 221 A DatasetConfig can be used to create a new dataset. 222 """ 223 return infer_dataset_schema(name, df, DataSetType.GLOBAL, infer_from_column_names=False)
Creates a independent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex.
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
226def getDataSetSchema(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 227 """ 228 Retrieves a DataSetConfig representing the schema of an existing dataset. 229 230 Parameters 231 ---------- 232 apikey: str 233 API key provided by Boosted. This key should be protected as a secret. 234 dataset_id: str 235 Dataset ID. Can be from the output of addIndependentDataset or be found 236 in your Custom Data listing in Boosted Insights. 237 proxy: str 238 Your organization may require the use of a proxy for access. 239 The address of a HTTPS proxy in the format of <address>:<port>. 240 Examples are "123.456.789:123" or "my.proxy.com:123". 241 Do not prepend with "https://". 242 disable_verify_ssl: bool 243 Your networking setup may be behind a firewall which performs SSL 244 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 245 to point to the location of a custom certificate bundle, or set this 246 parameter to true to disable SSL verification as a workaround. 247 248 Returns 249 ------- 250 DataSetConfig 251 A DataSetConfig can be used to create a new dataset. 252 """ 253 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 254 return client.get_dataset_schema(dataset_id)
Retrieves a DataSetConfig representing the schema of an existing dataset.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
DataSetConfig A DataSetConfig can be used to create a new dataset.
257def addDependentDataset( 258 apikey, 259 dataset, 260 datasetName="DependentDataset", 261 datasetConfig=None, 262 proxy=None, 263 disable_verify_ssl=False, 264 timeout: int = 600, 265 block: bool = True, 266): 267 """ 268 Creates a new dependent dataset. 269 270 Creates a new dataset by inferring a schema from your dataset. This will 271 also upload the dataset. 272 273 See http://docs.insights.boosted.ai/integrated-data for more information 274 on formatting. 275 276 Parameters 277 ---------- 278 apikey: str 279 API key provided by Boosted. This key should be protected as a secret. 280 dataset: pandas.DataFrame 281 Pandas DataFrame containing your data. The index must be 282 DatetimeIndex. The first columns must be ISIN, Country, Currency, 283 or comprise all identifier columns in the dataset schema if a schema was 284 specified 285 datasetName: str 286 Name for this dataset. 287 datasetConfig: DatasetConfig 288 A pre-configured dataset schema 289 proxy: str 290 Your organization may require the use of a proxy for access. 291 The address of a HTTPS proxy in the format of <address>:<port>. 292 Examples are "123.456.789:123" or "my.proxy.com:123". 293 Do not prepend with "https://". 294 disable_verify_ssl: bool 295 Your networking setup may be behind a firewall which performs SSL 296 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 297 to point to the location of a custom certificate bundle, or set this 298 parameter to true to disable SSL verification as a workaround. 299 timeout: int = 600 300 Number of seconds before a timeout error should be triggered. 301 block: bool = True 302 Whether the python process should block until the dataset is fully 303 uploaded and processed. 304 305 Returns 306 ------- 307 str 308 Dataset ID of the newly created dataset. 309 """ 310 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 311 return client.add_dependent_dataset( 312 dataset, datasetName, datasetConfig, timeout=timeout, block=block 313 )
Creates a new dependent dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/integrated-data for more information on formatting.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency, or comprise all identifier columns in the dataset schema if a schema was specified datasetName: str Name for this dataset. datasetConfig: DatasetConfig A pre-configured dataset schema proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset ID of the newly created dataset.
316def addIndependentDataset( 317 apikey, 318 dataset, 319 datasetName="IndependentDataset", 320 datasetConfig=None, 321 proxy=None, 322 disable_verify_ssl=False, 323 timeout: int = 600, 324 block: bool = True, 325): 326 """ 327 Creates a new independent dataset. 328 329 Creates a new dataset by inferring a schema from your dataset. This will 330 also upload the dataset. 331 332 See http://docs.insights.boosted.ai/independent-data for more information 333 on formatting. 334 335 Parameters 336 ---------- 337 apikey: str 338 API key provided by Boosted. This key should be protected as a secret. 339 dataset: pandas.DataFrame 340 Pandas DataFrame containing your data. The index must be 341 DatetimeIndex. The first column must be a unique custom security identifier 342 datasetName: str 343 Name for this dataset. 344 datasetConfig: DatasetConfig 345 A pre-configured dataset schema 346 proxy: str 347 Your organization may require the use of a proxy for access. 348 The address of a HTTPS proxy in the format of <address>:<port>. 349 Examples are "123.456.789:123" or "my.proxy.com:123". 350 Do not prepend with "https://". 351 disable_verify_ssl: bool 352 Your networking setup may be behind a firewall which performs SSL 353 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 354 to point to the location of a custom certificate bundle, or set this 355 parameter to true to disable SSL verification as a workaround. 356 timeout: int = 600 357 Number of seconds before a timeout error should be triggered. 358 block: bool = True 359 Whether the python process should block until the dataset is fully 360 uploaded and processed. 361 362 Returns 363 ------- 364 str 365 Dataset ID of the newly created dataset. 366 """ 367 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 368 return client.add_independent_dataset( 369 dataset, datasetName, datasetConfig, timeout=timeout, block=block 370 )
Creates a new independent dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/independent-data for more information on formatting.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be a unique custom security identifier datasetName: str Name for this dataset. datasetConfig: DatasetConfig A pre-configured dataset schema proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset ID of the newly created dataset.
373def addGlobalDataset( 374 apikey, 375 dataset, 376 datasetName="GlobalDataset", 377 datasetConfig=None, 378 proxy=None, 379 disable_verify_ssl=False, 380 timeout: int = 600, 381 block: bool = True, 382): 383 """ 384 Creates a new global dataset. 385 386 Creates a new dataset by inferring a schema from your dataset. This will 387 also upload the dataset. 388 389 See http://docs.insights.boosted.ai/global-data for more information 390 on formatting. 391 392 Parameters 393 ---------- 394 apikey: str 395 API key provided by Boosted. This key should be protected as a secret. 396 dataset: pandas.DataFrame 397 Pandas DataFrame containing your data. The index must be 398 DatetimeIndex. 399 datasetName: str 400 Name for this dataset. 401 datasetConfig: DatasetConfig 402 A pre-configured dataset schema 403 proxy: str 404 Your organization may require the use of a proxy for access. 405 The address of a HTTPS proxy in the format of <address>:<port>. 406 Examples are "123.456.789:123" or "my.proxy.com:123". 407 Do not prepend with "https://". 408 disable_verify_ssl: bool 409 Your networking setup may be behind a firewall which performs SSL 410 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 411 to point to the location of a custom certificate bundle, or set this 412 parameter to true to disable SSL verification as a workaround. 413 timeout: int = 600 414 Number of seconds before a timeout error should be triggered. 415 block: bool = True 416 Whether the python process should block until the dataset is fully 417 uploaded and processed. 418 419 Returns 420 ------- 421 str 422 Dataset ID of the newly created dataset. 423 """ 424 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 425 return client.add_global_dataset( 426 dataset, datasetName, datasetConfig, timeout=timeout, block=block 427 )
Creates a new global dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/global-data for more information on formatting.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. datasetName: str Name for this dataset. datasetConfig: DatasetConfig A pre-configured dataset schema proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset ID of the newly created dataset.
430def addCustomSecurityNamespaceMembers( 431 apikey, 432 namespace, 433 members, 434 proxy, 435 disable_verify_ssl=False, 436): 437 """ 438 Uploads namespace members (tickers, or stock identifiers) into the specified 439 security namespace. 440 441 Parameters 442 ---------- 443 apikey: str 444 API key provided by Boosted. This key should be protected as a secret. 445 namespace: str 446 Namespace to upload to. This is any string representing a private collection of 447 securities that you may refer to with the format <namespace>\\<symbol> 448 in other custom data uploads. 449 members: DataFrame | str 450 A CSV or dataframe representing a CSV containing the securities to upload 451 This tabular data should have columns 452 Symbol Country Currency Name 453 case sensitive, where country and currency are 3-letter ISO country/currency codes. 454 proxy: str 455 Your organization may require the use of a proxy for access. 456 The address of a HTTPS proxy in the format of <address>:<port>. 457 Examples are "123.456.789:123" or "my.proxy.com:123". 458 Do not prepend with "https://". 459 disable_verify_ssl: bool 460 Your networking setup may be behind a firewall which performs SSL 461 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 462 to point to the location of a custom certificate bundle, or set this 463 parameter to true to disable SSL verification as a workaround. 464 465 466 Returns 467 ------- 468 str 469 Dataset ID of the newly created dataset. 470 """ 471 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 472 return client.add_custom_security_namespace_members(namespace, members)
Uploads namespace members (tickers, or stock identifiers) into the specified security namespace.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
namespace: str
Namespace to upload to. This is any string representing a private collection of
securities that you may refer to with the format
Returns
str Dataset ID of the newly created dataset.
475def addCustomSecurityDailyData( 476 apikey, 477 namespace, 478 dataset, 479 datasetConfig=None, 480 proxy=None, 481 disable_verify_ssl=False, 482): 483 """ 484 Creates a new custom security daily dataset. 485 486 Creates a new dataset by inferring a schema from your dataset. This will 487 also upload the dataset. 488 489 See http://docs.insights.boosted.ai/integrated-data for more information 490 on formatting. 491 492 Parameters 493 ---------- 494 apikey: str 495 API key provided by Boosted. This key should be protected as a secret. 496 namespace: str 497 Namespace to upload to. This is any string representing a private collection of 498 securities that you may refer to with the format <namespace>\\<symbol> 499 in other custom data uploads. 500 dataset: pandas.DataFrame 501 Pandas DataFrame containing your data. The index must be 502 DatetimeIndex. 503 504 For custom security, we expect at minimum a custom security identifier and 505 a close price. The CSV header should look like this: 506 custom_security,daily_close 507 with support for the following pricing data fields in total: 508 daily_open 509 daily_close 510 daily_vwap 511 daily_high 512 daily_low 513 daily_bid 514 daily_ask 515 daily_volume (default high volume) 516 daily_mcap (default high mcap) 517 The custom security column should contain the symbols uploaded to the namespace above. 518 519 Please note that any missing values (nans, empty csv fields) are converted to 520 field-level defaults, which are usually 0.0 for pricing fields and a large 521 number for market cap and volume for assumed liquidity. 522 523 datasetConfig: DatasetConfig 524 A pre-configured dataset schema. 525 proxy: str 526 Your organization may require the use of a proxy for access. 527 The address of a HTTPS proxy in the format of <address>:<port>. 528 Examples are "123.456.789:123" or "my.proxy.com:123". 529 Do not prepend with "https://". 530 disable_verify_ssl: bool 531 Your networking setup may be behind a firewall which performs SSL 532 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 533 to point to the location of a custom certificate bundle, or set this 534 parameter to true to disable SSL verification as a workaround. 535 536 Returns 537 ------- 538 str 539 Dataset id of the dataset uploaded to through the namespace. 540 """ 541 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 542 return client.add_custom_security_daily_dataset(namespace, dataset, schema=datasetConfig)
Creates a new custom security daily dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/integrated-data for more information on formatting.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
namespace: str
Namespace to upload to. This is any string representing a private collection of
securities that you may refer to with the format
For custom security, we expect at minimum a custom security identifier and
a close price. The CSV header should look like this:
custom_security,daily_close
with support for the following pricing data fields in total:
daily_open
daily_close
daily_vwap
daily_high
daily_low
daily_bid
daily_ask
daily_volume (default high volume)
daily_mcap (default high mcap)
The custom security column should contain the symbols uploaded to the namespace above.
Please note that any missing values (nans, empty csv fields) are converted to
field-level defaults, which are usually 0.0 for pricing fields and a large
number for market cap and volume for assumed liquidity.
datasetConfig: DatasetConfig A pre-configured dataset schema. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset id of the dataset uploaded to through the namespace.
545def exportDependentDataset( 546 apikey, 547 dataset_id, 548 start=None, 549 end=None, 550 proxy=None, 551 disable_verify_ssl=False, 552 timeout: int = 600, 553): 554 """ 555 Exports an existing dependent dataset. 556 557 Exports an existing dataset identified by a dataset ID. Returns the data 558 as a Pandas DataFrame. 559 560 Parameters 561 ---------- 562 apikey: str 563 API key provided by Boosted. This key should be protected as a secret. 564 dataset_id: str 565 Dataset ID. Can be from the output of addDependentDataset or be found 566 in your Custom Data listing in Boosted Insights. 567 start: datetime.date or YYYY-MM-DD string 568 The date from which data will be exported. 569 end: datetime.date or YYYY-MM-DD string 570 The date until which data will be exported. 571 proxy: str 572 Your organization may require the use of a proxy for access. 573 The address of a HTTPS proxy in the format of <address>:<port>. 574 Examples are "123.456.789:123" or "my.proxy.com:123". 575 Do not prepend with "https://". 576 disable_verify_ssl: bool 577 Your networking setup may be behind a firewall which performs SSL 578 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 579 to point to the location of a custom certificate bundle, or set this 580 parameter to true to disable SSL verification as a workaround. 581 timeout: int = 600 582 Number of seconds before a timeout error should be triggered. 583 584 Returns 585 ------- 586 pandas.DataFrame 587 Pandas DataFrame containing your data that will be indexed by the date. 588 The DataFrame schema is identical to the one used to upload a dataset. 589 """ 590 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 591 return client.export_dependent_data(dataset_id, start=start, end=end, timeout=timeout)
Exports an existing dependent dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. start: datetime.date or YYYY-MM-DD string The date from which data will be exported. end: datetime.date or YYYY-MM-DD string The date until which data will be exported. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
594def exportIndependentDataset( 595 apikey, 596 dataset_id, 597 start=(datetime.date.today() - timedelta(days=365 * 25)), 598 end=datetime.date.today(), 599 proxy=None, 600 disable_verify_ssl=False, 601 timeout: int = 600, 602): 603 """ 604 Exports an existing independent dataset. 605 606 Exports an existing dataset identified by a dataset ID. Returns the data 607 as a Pandas DataFrame. 608 609 Parameters 610 ---------- 611 apikey: str 612 API key provided by Boosted. This key should be protected as a secret. 613 dataset_id: str 614 Dataset ID. Can be from the output of addIndependentDataset or be found 615 in your Custom Data listing in Boosted Insights. 616 start: datetime.date or YYYY-MM-DD string 617 The date from which data will be exported. 618 end: datetime.date or YYYY-MM-DD string 619 The date until which data will be exported. 620 proxy: str 621 Your organization may require the use of a proxy for access. 622 The address of a HTTPS proxy in the format of <address>:<port>. 623 Examples are "123.456.789:123" or "my.proxy.com:123". 624 Do not prepend with "https://". 625 disable_verify_ssl: bool 626 Your networking setup may be behind a firewall which performs SSL 627 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 628 to point to the location of a custom certificate bundle, or set this 629 parameter to true to disable SSL verification as a workaround. 630 timeout: int = 600 631 Number of seconds before a timeout error should be triggered. 632 633 Returns 634 ------- 635 pandas.DataFrame 636 Pandas DataFrame containing your data that will be indexed by the date. 637 The DataFrame schema is identical to the one used to upload a dataset. 638 """ 639 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 640 return client.export_independent_data(dataset_id, start, end, timeout=timeout)
Exports an existing independent dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. start: datetime.date or YYYY-MM-DD string The date from which data will be exported. end: datetime.date or YYYY-MM-DD string The date until which data will be exported. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
643def exportGlobalDataset( 644 apikey, 645 dataset_id, 646 start=(datetime.date.today() - timedelta(days=365 * 25)), 647 end=datetime.date.today(), 648 proxy=None, 649 disable_verify_ssl=False, 650 timeout: int = 600, 651): 652 """ 653 Exports an existing global dataset. 654 655 Exports an existing dataset identified by a dataset ID. Returns the data 656 as a Pandas DataFrame. 657 658 Parameters 659 ---------- 660 apikey: str 661 API key provided by Boosted. This key should be protected as a secret. 662 dataset_id: str 663 Dataset ID. Can be from the output of addGlobalDataset or be found 664 in your Custom Data listing in Boosted Insights. 665 start: datetime.date or YYYY-MM-DD string 666 The date from which data will be exported. 667 end: datetime.date or YYYY-MM-DD string 668 The date until which data will be exported. 669 proxy: str 670 Your organization may require the use of a proxy for access. 671 The address of a HTTPS proxy in the format of <address>:<port>. 672 Examples are "123.456.789:123" or "my.proxy.com:123". 673 Do not prepend with "https://". 674 disable_verify_ssl: bool 675 Your networking setup may be behind a firewall which performs SSL 676 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 677 to point to the location of a custom certificate bundle, or set this 678 parameter to true to disable SSL verification as a workaround. 679 timeout: int = 600 680 Number of seconds before a timeout error should be triggered. 681 682 Returns 683 ------- 684 pandas.DataFrame 685 Pandas DataFrame containing your data that will be indexed by the date. 686 The DataFrame schema is identical to the one used to upload a dataset. 687 """ 688 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 689 return client.export_global_data(dataset_id, start, end, timeout=timeout)
Exports an existing global dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addGlobalDataset or be found in your Custom Data listing in Boosted Insights. start: datetime.date or YYYY-MM-DD string The date from which data will be exported. end: datetime.date or YYYY-MM-DD string The date until which data will be exported. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
692def exportCustomSecurityDataset( 693 apikey, 694 dataset_id, 695 start=(datetime.date.today() - timedelta(days=365 * 25)), 696 end=datetime.date.today(), 697 proxy=None, 698 disable_verify_ssl=False, 699): 700 """ 701 Exports an existing custom security dataset. 702 703 Exports an existing dataset identified by a dataset ID. Returns the data 704 as a Pandas DataFrame. 705 706 Parameters 707 ---------- 708 apikey: str 709 API key provided by Boosted. This key should be protected as a secret. 710 dataset_id: str 711 Dataset ID of the custom security dataset. This is not a namespace, but 712 rather the output of addCustomSecurityDailyData. 713 start: datetime.date 714 Starting date range to export. Defaults to today minus 25 years. 715 end: datetime.date 716 Ending date range to export. Defaults to today. 717 proxy: str 718 Your organization may require the use of a proxy for access. 719 The address of a HTTPS proxy in the format of <address>:<port>. 720 Examples are "123.456.789:123" or "my.proxy.com:123". 721 Do not prepend with "https://". 722 disable_verify_ssl: bool 723 Your networking setup may be behind a firewall which performs SSL 724 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 725 to point to the location of a custom certificate bundle, or set this 726 parameter to true to disable SSL verification as a workaround. 727 728 Returns 729 ------- 730 pandas.DataFrame 731 Pandas DataFrame containing your data that will be indexed by the date. 732 The DataFrame schema is identical to the one used to upload a dataset. 733 """ 734 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 735 return client.export_custom_security_data(dataset_id, start=start, end=end)
Exports an existing custom security dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID of the custom security dataset. This is not a namespace, but rather the output of addCustomSecurityDailyData. start: datetime.date Starting date range to export. Defaults to today minus 25 years. end: datetime.date Ending date range to export. Defaults to today. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
738def addDependentData( 739 apikey, 740 dataset_id, 741 dataset, 742 proxy=None, 743 disable_verify_ssl=False, 744 timeout: int = 600, 745 block: bool = True, 746): 747 """ 748 Adds data to an existing dependent dataset. 749 750 This uploads the data in ``dataset`` to an existing dataset. Existing 751 date/ISIN pairs will be overwritten. 752 753 Parameters 754 ---------- 755 apikey: str 756 API key provided by Boosted. This key should be protected as a secret. 757 dataset_id: str 758 Dataset ID. Can be from the output of addDependentDataset or be found 759 in your Custom Data listing in Boosted Insights. 760 dataset: pandas.DataFrame 761 Pandas DataFrame containing your data. The index must be 762 DatetimeIndex. The first columns must comprise all identifier columns in the 763 dataset schema. 764 proxy: str 765 Your organization may require the use of a proxy for access. 766 The address of a HTTPS proxy in the format of <address>:<port>. 767 Examples are "123.456.789:123" or "my.proxy.com:123". 768 Do not prepend with "https://". 769 disable_verify_ssl: bool 770 Your networking setup may be behind a firewall which performs SSL 771 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 772 to point to the location of a custom certificate bundle, or set this 773 parameter to true to disable SSL verification as a workaround. 774 timeout: int = 600 775 Number of seconds before a timeout error should be triggered. 776 block: bool = True 777 Whether the python process should block until the dataset is fully 778 uploaded and processed. 779 780 Returns 781 ------- 782 None 783 """ 784 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 785 return client.add_dependent_data( 786 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 787 )
Adds data to an existing dependent dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/ISIN pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must comprise all identifier columns in the dataset schema. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
790def addIndependentData( 791 apikey, 792 dataset_id, 793 dataset, 794 proxy=None, 795 disable_verify_ssl=False, 796 timeout: int = 600, 797 block: bool = True, 798): 799 """ 800 Adds data to an existing independent dataset. 801 802 This uploads the data in ``dataset`` to an existing dataset. Existing 803 dates will be overwritten. 804 805 Parameters 806 ---------- 807 apikey: str 808 API key provided by Boosted. This key should be protected as a secret. 809 dataset_id: str 810 Dataset ID. Can be from the output of addIndependentDataset or be found 811 in your Custom Data listing in Boosted Insights. 812 dataset: pandas.DataFrame 813 Pandas DataFrame containing your data. The index must be 814 DatetimeIndex. 815 proxy: str 816 Your organization may require the use of a proxy for access. 817 The address of a HTTPS proxy in the format of <address>:<port>. 818 Examples are "123.456.789:123" or "my.proxy.com:123". 819 Do not prepend with "https://". 820 disable_verify_ssl: bool 821 Your networking setup may be behind a firewall which performs SSL 822 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 823 to point to the location of a custom certificate bundle, or set this 824 parameter to true to disable SSL verification as a workaround. 825 timeout: int = 600 826 Number of seconds before a timeout error should be triggered. 827 block: bool = True 828 Whether the python process should block until the dataset is fully 829 uploaded and processed. 830 831 Returns 832 ------- 833 None 834 """ 835 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 836 return client.add_independent_data( 837 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 838 )
Adds data to an existing independent dataset.
This uploads the data in dataset
to an existing dataset. Existing
dates will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
841def addGlobalData( 842 apikey, 843 dataset_id, 844 dataset, 845 proxy=None, 846 disable_verify_ssl=False, 847 timeout: int = 600, 848 block: bool = True, 849): 850 """ 851 Adds data to an existing global dataset. 852 853 This uploads the data in ``dataset`` to an existing dataset. Existing 854 date/custom security identifier pairs will be overwritten. 855 856 Parameters 857 ---------- 858 apikey: str 859 API key provided by Boosted. This key should be protected as a secret. 860 dataset_id: str 861 Dataset ID. Can be from the output of addGlobalDataset or be found 862 in your Custom Data listing in Boosted Insights. 863 dataset: pandas.DataFrame 864 Pandas DataFrame containing your data. The index must be 865 DatetimeIndex. The first column must be custom security identifier 866 proxy: str 867 Your organization may require the use of a proxy for access. 868 The address of a HTTPS proxy in the format of <address>:<port>. 869 Examples are "123.456.789:123" or "my.proxy.com:123". 870 Do not prepend with "https://". 871 disable_verify_ssl: bool 872 Your networking setup may be behind a firewall which performs SSL 873 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 874 to point to the location of a custom certificate bundle, or set this 875 parameter to true to disable SSL verification as a workaround. 876 timeout: int = 600 877 Number of seconds before a timeout error should be triggered. 878 block: bool = True 879 Whether the python process should block until the dataset is fully 880 uploaded and processed. 881 882 Returns 883 ------- 884 None 885 """ 886 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 887 return client.add_global_data( 888 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 889 )
Adds data to an existing global dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/custom security identifier pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addGlobalDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be custom security identifier proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
892def addLiveDependentData( 893 apikey, 894 dataset_id, 895 dataset, 896 proxy=None, 897 disable_verify_ssl=False, 898 timeout: int = 600, 899 block: bool = True, 900): 901 """ 902 Adds live data to an existing dependent dataset. 903 904 This uploads the data in ``dataset`` to an existing dataset. Existing 905 date/ISIN pairs will be overwritten. 906 907 Parameters 908 ---------- 909 apikey: str 910 API key provided by Boosted. This key should be protected as a secret. 911 dataset_id: str 912 Dataset ID. Can be from the output of addDependentDataset or be found 913 in your Custom Data listing in Boosted Insights. 914 dataset: pandas.DataFrame 915 Pandas DataFrame containing your data. The index must be 916 DatetimeIndex. The first columns must be ISIN, Country, Currency. 917 proxy: str 918 Your organization may require the use of a proxy for access. 919 The address of a HTTPS proxy in the format of <address>:<port>. 920 Examples are "123.456.789:123" or "my.proxy.com:123". 921 Do not prepend with "https://". 922 disable_verify_ssl: bool 923 Your networking setup may be behind a firewall which performs SSL 924 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 925 to point to the location of a custom certificate bundle, or set this 926 parameter to true to disable SSL verification as a workaround. 927 timeout: int = 600 928 Number of seconds before a timeout error should be triggered. 929 block: bool = True 930 Whether the python process should block until the dataset is fully 931 uploaded and processed. 932 933 Returns 934 ------- 935 None 936 """ 937 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 938 return client.add_dependent_data( 939 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 940 )
Adds live data to an existing dependent dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/ISIN pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
943def addLiveIndependentData( 944 apikey, 945 dataset_id, 946 dataset, 947 proxy=None, 948 disable_verify_ssl=False, 949 timeout: int = 600, 950 block: bool = True, 951): 952 """ 953 Adds live data to an existing independent dataset. 954 955 This uploads the data in ``dataset`` to an existing dataset. Existing 956 dates will be overwritten. 957 958 Parameters 959 ---------- 960 apikey: str 961 API key provided by Boosted. This key should be protected as a secret. 962 dataset_id: str 963 Dataset ID. Can be from the output of addIndependentDataset or be found 964 in your Custom Data listing in Boosted Insights. 965 dataset: pandas.DataFrame 966 Pandas DataFrame containing your data. The index must be 967 DatetimeIndex. 968 proxy: str 969 Your organization may require the use of a proxy for access. 970 The address of a HTTPS proxy in the format of <address>:<port>. 971 Examples are "123.456.789:123" or "my.proxy.com:123". 972 Do not prepend with "https://". 973 disable_verify_ssl: bool 974 Your networking setup may be behind a firewall which performs SSL 975 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 976 to point to the location of a custom certificate bundle, or set this 977 parameter to true to disable SSL verification as a workaround. 978 timeout: int = 600 979 Number of seconds before a timeout error should be triggered. 980 block: bool = True 981 Whether the python process should block until the dataset is fully 982 uploaded and processed. 983 984 Returns 985 ------- 986 None 987 """ 988 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 989 return client.add_independent_data( 990 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 991 )
Adds live data to an existing independent dataset.
This uploads the data in dataset
to an existing dataset. Existing
dates will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
994def addLiveGlobalData( 995 apikey, 996 dataset_id, 997 dataset, 998 proxy=None, 999 disable_verify_ssl=False, 1000 timeout: int = 600, 1001 block: bool = True, 1002): 1003 """ 1004 Adds live data to an existing global dataset. 1005 1006 This uploads the data in ``dataset`` to an existing dataset. Existing 1007 date/custom security identifier pairs will be overwritten. 1008 1009 Parameters 1010 ---------- 1011 apikey: str 1012 API key provided by Boosted. This key should be protected as a secret. 1013 dataset_id: str 1014 Dataset ID. Can be from the output of addGlobalDataset or be found 1015 in your Custom Data listing in Boosted Insights. 1016 dataset: pandas.DataFrame 1017 Pandas DataFrame containing your data. The index must be 1018 DatetimeIndex. The first column must be custom security identifier 1019 proxy: str 1020 Your organization may require the use of a proxy for access. 1021 The address of a HTTPS proxy in the format of <address>:<port>. 1022 Examples are "123.456.789:123" or "my.proxy.com:123". 1023 Do not prepend with "https://". 1024 disable_verify_ssl: bool 1025 Your networking setup may be behind a firewall which performs SSL 1026 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1027 to point to the location of a custom certificate bundle, or set this 1028 parameter to true to disable SSL verification as a workaround. 1029 timeout: int = 600 1030 Number of seconds before a timeout error should be triggered. 1031 block: bool = True 1032 Whether the python process should block until the dataset is fully 1033 uploaded and processed. 1034 1035 Returns 1036 ------- 1037 None 1038 """ 1039 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1040 return client.add_global_data( 1041 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 1042 )
Adds live data to an existing global dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/custom security identifier pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addGlobalDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be custom security identifier proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
1045def queryDataset(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 1046 """ 1047 Queries the status, timerange of a dataset. 1048 1049 Returns meta-information about a dataset. This can be used to check the 1050 dateranges covered and the current status. 1051 1052 Parameters 1053 ---------- 1054 apikey: str 1055 API key provided by Boosted. This key should be protected as a secret. 1056 dataset_id: str 1057 Dataset ID. Can be from the output of addDependentDataset or be found 1058 in your Custom Data listing in Boosted Insights. 1059 proxy: str 1060 Your organization may require the use of a proxy for access. 1061 The address of a HTTPS proxy in the format of <address>:<port>. 1062 Examples are "123.456.789:123" or "my.proxy.com:123". 1063 Do not prepend with "https://". 1064 disable_verify_ssl: bool 1065 Your networking setup may be behind a firewall which performs SSL 1066 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1067 to point to the location of a custom certificate bundle, or set this 1068 parameter to true to disable SSL verification as a workaround. 1069 1070 Returns 1071 ------- 1072 dict: 1073 Dictionary containing meta-data about the dataset. 1074 1075 'created': <creation date>, 1076 'fileSize': <file size>, 1077 'id': <dataset ID>, 1078 'name': <dataset name>, 1079 'ownerId': <owner ID>, 1080 'region': <dataset region>, 1081 'status': {AVAILABLE|UPDATING|CREATING|ERROR}, 1082 'type': {STOCK|STRATEGY|GLOBAL}, 1083 'universeId': <universe ID>, 1084 'validFrom': [YYYY, MM, DD], 1085 'validTo': [YYYY, MM, DD]} 1086 1087 """ 1088 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1089 return client.query_dataset(dataset_id)
Queries the status, timerange of a dataset.
Returns meta-information about a dataset. This can be used to check the dateranges covered and the current status.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing meta-data about the dataset.
'created': <creation date>,
'fileSize': <file size>,
'id': <dataset ID>,
'name': <dataset name>,
'ownerId': <owner ID>,
'region': <dataset region>,
'status': {AVAILABLE|UPDATING|CREATING|ERROR},
'type': {STOCK|STRATEGY|GLOBAL},
'universeId': <universe ID>,
'validFrom': [YYYY, MM, DD],
'validTo': [YYYY, MM, DD]}
1092def getUniverse(apikey, model_id, date=None, proxy=None, disable_verify_ssl=False): 1093 """ 1094 Returns the universe members of a model. 1095 1096 Returns the members of the universe of a model. If no date is provided, 1097 effective date ranges will be returned. If a date is provided, only the 1098 universe members of that date are returned. The results are returned in a 1099 Pandas DataFrame. 1100 1101 For more information, see http://docs.insights.boosted.ai/universe-upload. 1102 1103 Parameters 1104 ---------- 1105 apikey: str 1106 API key provided by Boosted. This key should be protected as a secret. 1107 model_id: str 1108 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1109 button next to your model's name in the Model Summary Page in Boosted 1110 Insights. 1111 date: datetime.date or YYYY-MM-DD string 1112 Date of the universe to retrieve. 1113 proxy: str 1114 Your organization may require the use of a proxy for access. 1115 The address of a HTTPS proxy in the format of <address>:<port>. 1116 Examples are "123.456.789:123" or "my.proxy.com:123". 1117 Do not prepend with "https://". 1118 disable_verify_ssl: bool 1119 Your networking setup may be behind a firewall which performs SSL 1120 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1121 to point to the location of a custom certificate bundle, or set this 1122 parameter to true to disable SSL verification as a workaround. 1123 1124 Returns 1125 ------- 1126 pandas.DataFrame 1127 Pandas DataFrame containing the universe members. If a date was 1128 provided, only ISIN, Country, and Currency are returned. If no date 1129 was provided, returns From, To, ISIN, Country, Currency. 1130 """ 1131 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1132 return client.getUniverse(model_id, date)
Returns the universe members of a model.
Returns the members of the universe of a model. If no date is provided, effective date ranges will be returned. If a date is provided, only the universe members of that date are returned. The results are returned in a Pandas DataFrame.
For more information, see http://docs.insights.boosted.ai/universe-upload.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing the universe members. If a date was provided, only ISIN, Country, and Currency are returned. If no date was provided, returns From, To, ISIN, Country, Currency.
1135def updateUniverse( 1136 apikey, 1137 model_id, 1138 universe_df, 1139 date=datetime.date.today() + timedelta(1), 1140 proxy=None, 1141 disable_verify_ssl=False, 1142): 1143 """ 1144 Sets the universe members of a model. 1145 1146 Sets the members of the universe of a model. Universe members may only be 1147 set for future dates. 1148 1149 For more information, see http://docs.insights.boosted.ai/universe-upload. 1150 1151 Parameters 1152 ---------- 1153 apikey: str 1154 API key provided by Boosted. This key should be protected as a secret. 1155 model_id: str 1156 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1157 button next to your model's name in the Model Summary Page in Boosted 1158 Insights. 1159 universe_df: Pandas.DataFrame 1160 A Pandas.DataFrame with columns ISIN, Country, Currency. 1161 date: datetime.date or YYYY-MM-DD string 1162 Date of the universe to retrieve. 1163 proxy: str 1164 Your organization may require the use of a proxy for access. 1165 The address of a HTTPS proxy in the format of <address>:<port>. 1166 Examples are "123.456.789:123" or "my.proxy.com:123". 1167 Do not prepend with "https://". 1168 disable_verify_ssl: bool 1169 Your networking setup may be behind a firewall which performs SSL 1170 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1171 to point to the location of a custom certificate bundle, or set this 1172 parameter to true to disable SSL verification as a workaround. 1173 1174 Returns 1175 ------- 1176 str 1177 Any warnings, e.g. failure to map ISINs, are returned. 1178 """ 1179 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1180 return client.updateUniverse(model_id, universe_df, date)
Sets the universe members of a model.
Sets the members of the universe of a model. Universe members may only be set for future dates.
For more information, see http://docs.insights.boosted.ai/universe-upload.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. universe_df: Pandas.DataFrame A Pandas.DataFrame with columns ISIN, Country, Currency. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Any warnings, e.g. failure to map ISINs, are returned.
1183def createUniverse( 1184 apikey: str, 1185 universe: Union[pd.DataFrame, str], 1186 name: str, 1187 description: Optional[str] = None, 1188 proxy=None, 1189 disable_verify_ssl=False, 1190) -> List[str]: 1191 """ 1192 Creates a new boosted security universe. 1193 1194 Columns in the universe (dataframe or csv file path) to identify the 1195 universe are isin and/or symbol, from, to, country, currency. 1196 1197 Note that either isin or symbol are required columns. 1198 1199 Rules for the universe data are identical to those on the web universe 1200 creation screen: 1201 - Make sure your CSV does not contain empty columns. 1202 - Date columns must be in YYYY-MM-DD format. 1203 - The "from" and "to" fields represent the date range for which a 1204 security will exist in the universe for. The keyword "PRESENT" can be used 1205 in place of the "to_date" field. If you wish to create a Live model, ensure that 1206 at least some securities have "PRESENT" as their "to_date" field. 1207 - If the "to_date" column is ommitted, securites will exist in the universe 1208 until "PRESENT" by default, if possible. 1209 - "from" will default to "the beginning of time" if unspecified, and 1210 "to" will default to "PRESENT" 1211 1212 - The keyword "ANY" can also be used in place of the country and currency 1213 fields. 1214 - Rows with "ANY" will select the optimal security based on other securities 1215 in the portfolio For Country and Currency, the prefix "P_" (i.e. "P_USA") 1216 means "preferred." The model will attempt to match the security to the 1217 preferred specification. 1218 - "country" and "currency" will default to "ANY" if the column was 1219 omitted. 1220 1221 Parameters 1222 ---------- 1223 apikey: str 1224 API key provided by Boosted. This key should be protected as a secret. 1225 universe: Union[Pandas.DataFrame, str] 1226 May be either a Pandas.DataFrame, or a path to a csv. 1227 name: str 1228 The name of the new universe. 1229 description: str 1230 Optional description of the new universe. 1231 proxy: str 1232 Your organization may require the use of a proxy for access. 1233 The address of a HTTPS proxy in the format of <address>:<port>. 1234 Examples are "123.456.789:123" or "my.proxy.com:123". 1235 Do not prepend with "https://". 1236 disable_verify_ssl: bool 1237 Your networking setup may be behind a firewall which performs SSL 1238 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1239 to point to the location of a custom certificate bundle, or set this 1240 parameter to true to disable SSL verification as a workaround. 1241 1242 Returns 1243 ------- 1244 List[str] 1245 List of any warnings, e.g. failure to map ISINs, are returned. Return 1246 empty list if no warnings are returned. 1247 """ 1248 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1249 description = "" if description is None else description 1250 return client.create_universe(universe, name, description)
Creates a new boosted security universe.
Columns in the universe (dataframe or csv file path) to identify the universe are isin and/or symbol, from, to, country, currency.
Note that either isin or symbol are required columns.
Rules for the universe data are identical to those on the web universe creation screen:
- Make sure your CSV does not contain empty columns.
- Date columns must be in YYYY-MM-DD format.
- The "from" and "to" fields represent the date range for which a security will exist in the universe for. The keyword "PRESENT" can be used in place of the "to_date" field. If you wish to create a Live model, ensure that at least some securities have "PRESENT" as their "to_date" field.
- If the "to_date" column is ommitted, securites will exist in the universe until "PRESENT" by default, if possible.
- "from" will default to "the beginning of time" if unspecified, and "to" will default to "PRESENT"
- The keyword "ANY" can also be used in place of the country and currency fields.
- Rows with "ANY" will select the optimal security based on other securities in the portfolio For Country and Currency, the prefix "P_" (i.e. "P_USA") means "preferred." The model will attempt to match the security to the preferred specification.
- "country" and "currency" will default to "ANY" if the column was omitted.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. universe: Union[Pandas.DataFrame, str] May be either a Pandas.DataFrame, or a path to a csv. name: str The name of the new universe. description: str Optional description of the new universe. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
List[str] List of any warnings, e.g. failure to map ISINs, are returned. Return empty list if no warnings are returned.
1253def getAllocationsForDate( 1254 apikey, 1255 portfolio_id, 1256 date=datetime.date.today(), 1257 rollback_to_last_available_date=False, 1258 proxy=None, 1259 disable_verify_ssl=False, 1260): 1261 """ 1262 Get the allocations for a portfolio on a date. 1263 1264 Parameters 1265 ---------- 1266 apikey: str 1267 API key provided by Boosted. This key should be protected as a secret. 1268 portfolio_id: str 1269 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1270 date: datetime.date or YYYY-MM-DD string 1271 Date of the universe to retrieve. 1272 rollback_to_last_available_date: bool 1273 Whether or not to retrieve rankings for the most recent date if the current date 1274 is not a trade date. 1275 proxy: str 1276 Your organization may require the use of a proxy for access. 1277 The address of a HTTPS proxy in the format of <address>:<port>. 1278 Examples are "123.456.789:123" or "my.proxy.com:123". 1279 Do not prepend with "https://". 1280 disable_verify_ssl: bool 1281 Your networking setup may be behind a firewall which performs SSL 1282 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1283 to point to the location of a custom certificate bundle, or set this 1284 parameter to true to disable SSL verification as a workaround. 1285 1286 Returns 1287 ------- 1288 dict: 1289 Dictionary containing allocation information: 1290 model_id: str 1291 - Model id from accompanying portfolio 1292 date: str 1293 - Date string in yyyy/mm/dd format of date of the allocation data 1294 allocations: List of dict 1295 - List of allocation information 1296 allocation: float 1297 - Allocation of security 1298 allocation_delta: float 1299 - Difference in allocation compared to previous trade 1300 company_name: str 1301 - Security name 1302 country: str 1303 - Security exchange region 1304 currency: str 1305 - Security currency 1306 has_trade_signal: bool 1307 - If trade was based on signal or outside reason 1308 isin: str 1309 - ISIN of security 1310 price: float 1311 - Price of security 1312 shares_owned: float 1313 - Current shares of the security 1314 shares_traded: float 1315 - Number of share traded of te security 1316 symbol: str 1317 - Symbol of the security 1318 """ 1319 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1320 return client.getAllocationsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the allocations for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing allocation information: model_id: str - Model id from accompanying portfolio date: str - Date string in yyyy/mm/dd format of date of the allocation data allocations: List of dict - List of allocation information allocation: float - Allocation of security allocation_delta: float - Difference in allocation compared to previous trade company_name: str - Security name country: str - Security exchange region currency: str - Security currency has_trade_signal: bool - If trade was based on signal or outside reason isin: str - ISIN of security price: float - Price of security shares_owned: float - Current shares of the security shares_traded: float - Number of share traded of te security symbol: str - Symbol of the security
1323def getAllocationsForDateV2( 1324 apikey, 1325 portfolio_id, 1326 date=datetime.date.today(), 1327 rollback_to_last_available_date=False, 1328 proxy=None, 1329 disable_verify_ssl=False, 1330): 1331 """ 1332 Get the allocations for a portfolio on a date. 1333 1334 Parameters 1335 ---------- 1336 apikey: str 1337 API key provided by Boosted. This key should be protected as a secret. 1338 portfolio_id: str 1339 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1340 date: datetime.date or YYYY-MM-DD string 1341 Date of the universe to retrieve. 1342 rollback_to_last_available_date: bool 1343 Whether or not to retrieve rankings for the most recent date if the current date 1344 is not a trade date. 1345 proxy: str 1346 Your organization may require the use of a proxy for access. 1347 The address of a HTTPS proxy in the format of <address>:<port>. 1348 Examples are "123.456.789:123" or "my.proxy.com:123". 1349 Do not prepend with "https://". 1350 disable_verify_ssl: bool 1351 Your networking setup may be behind a firewall which performs SSL 1352 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1353 to point to the location of a custom certificate bundle, or set this 1354 parameter to true to disable SSL verification as a workaround. 1355 1356 Returns 1357 ------- 1358 dict: 1359 Dictionary containing allocation information: 1360 model_id: str 1361 - Model id from accompanying portfolio 1362 date: str 1363 - Date string in yyyy/mm/dd format of date of the allocation data 1364 allocations: List of dict 1365 - List of allocation information 1366 allocation: float 1367 - Allocation of security 1368 allocation_delta: float 1369 - Difference in allocation compared to previous allocation 1370 company_name: str 1371 - Security name 1372 country: str 1373 - Security exchange region 1374 currency: str 1375 - Security currency 1376 has_trade_signal: bool 1377 - If trade was based on signal or outside reason 1378 isin: str 1379 - ISIN of security 1380 price: float 1381 - Price of security 1382 shares_owned: float 1383 - Current shares of the security 1384 shares_traded: float 1385 - Number of shares traded of te security 1386 symbol: str 1387 - Symbol of the security 1388 """ 1389 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1390 return client.getAllocationsForDateV2(portfolio_id, date, rollback_to_last_available_date)
Get the allocations for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing allocation information: model_id: str - Model id from accompanying portfolio date: str - Date string in yyyy/mm/dd format of date of the allocation data allocations: List of dict - List of allocation information allocation: float - Allocation of security allocation_delta: float - Difference in allocation compared to previous allocation company_name: str - Security name country: str - Security exchange region currency: str - Security currency has_trade_signal: bool - If trade was based on signal or outside reason isin: str - ISIN of security price: float - Price of security shares_owned: float - Current shares of the security shares_traded: float - Number of shares traded of te security symbol: str - Symbol of the security
1393def getAllocationsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1394 """ 1395 Get the allocations for a portfolio on all dates. 1396 1397 Parameters 1398 ---------- 1399 apikey: str 1400 API key provided by Boosted. This key should be protected as a secret. 1401 portfolio_id: str 1402 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1403 proxy: str 1404 Your organization may require the use of a proxy for access. 1405 The address of a HTTPS proxy in the format of <address>:<port>. 1406 Examples are "123.456.789:123" or "my.proxy.com:123". 1407 Do not prepend with "https://". 1408 disable_verify_ssl: bool 1409 Your networking setup may be behind a firewall which performs SSL 1410 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1411 to point to the location of a custom certificate bundle, or set this 1412 parameter to true to disable SSL verification as a workaround. 1413 1414 Returns 1415 ------- 1416 dict: 1417 Dictionary containing allocation information. 1418 model_id: str 1419 - Model id from accompanying portfolio 1420 allocations: dict 1421 keys: date of the allocations in the value 1422 value: list of dict 1423 - List of allocation information 1424 allocation: float 1425 - Allocation of security 1426 allocation_delta: float 1427 - Difference in allocation compared to previous trade 1428 company_name: str 1429 - Security name 1430 country: str 1431 - Security exchange region 1432 currency: str 1433 - Security currency 1434 has_trade_signal: bool 1435 - If trade was based on signal or outside reason 1436 isin: str 1437 - ISIN of security 1438 price: float 1439 - Price of security 1440 shares_owned: float 1441 - Current shares of the security 1442 shares_traded: float 1443 - Number of share traded of te security 1444 symbol: str 1445 - Symbol of the security 1446 """ 1447 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1448 return client.getAllocationsByDates(portfolio_id)
Get the allocations for a portfolio on all dates.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing allocation information. model_id: str - Model id from accompanying portfolio allocations: dict keys: date of the allocations in the value value: list of dict - List of allocation information allocation: float - Allocation of security allocation_delta: float - Difference in allocation compared to previous trade company_name: str - Security name country: str - Security exchange region currency: str - Security currency has_trade_signal: bool - If trade was based on signal or outside reason isin: str - ISIN of security price: float - Price of security shares_owned: float - Current shares of the security shares_traded: float - Number of share traded of te security symbol: str - Symbol of the security
1451def getSignalsForDate( 1452 apikey, 1453 portfolio_id, 1454 date=datetime.date.today(), 1455 rollback_to_last_available_date=False, 1456 proxy=None, 1457 disable_verify_ssl=False, 1458): 1459 """ 1460 Get the signals for a portfolio on a date. 1461 1462 Parameters 1463 ---------- 1464 apikey: str 1465 API key provided by Boosted. This key should be protected as a secret. 1466 portfolio_id: str 1467 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1468 date: datetime.date or YYYY-MM-DD string 1469 Date of the universe to retrieve. 1470 rollback_to_last_available_date: bool 1471 Whether or not to retrieve rankings for the most recent date if the current date 1472 is not a trade date. 1473 proxy: str 1474 Your organization may require the use of a proxy for access. 1475 The address of a HTTPS proxy in the format of <address>:<port>. 1476 Examples are "123.456.789:123" or "my.proxy.com:123". 1477 Do not prepend with "https://". 1478 disable_verify_ssl: bool 1479 Your networking setup may be behind a firewall which performs SSL 1480 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1481 to point to the location of a custom certificate bundle, or set this 1482 parameter to true to disable SSL verification as a workaround. 1483 1484 Returns 1485 ------- 1486 dict: 1487 Dictionary containing signals information: 1488 date: str 1489 - Date string in YYYY-MM-DD format of date of the signal data 1490 signals: List of dict 1491 - List of signal information per model 1492 model_id: str 1493 - Model id from accompanying portfolio 1494 signals_info: List of dict 1495 - Signal information for each security per model id 1496 company_name: str 1497 - Security name 1498 country: str 1499 - Security exchange region 1500 currency: str 1501 - Security currency 1502 date: str 1503 - Date of the signal data 1504 isin: str 1505 - ISIN of security 1506 signal: float 1507 - Signal from model 1508 signal_delta: float 1509 - Change in signal compared to last trade 1510 symbol: str 1511 - Symbol of the security 1512 """ 1513 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1514 return client.getSignalsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the signals for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing signals information: date: str - Date string in YYYY-MM-DD format of date of the signal data signals: List of dict - List of signal information per model model_id: str - Model id from accompanying portfolio signals_info: List of dict - Signal information for each security per model id company_name: str - Security name country: str - Security exchange region currency: str - Security currency date: str - Date of the signal data isin: str - ISIN of security signal: float - Signal from model signal_delta: float - Change in signal compared to last trade symbol: str - Symbol of the security
1517def getSignalsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1518 """ 1519 Get the signals for all dates in the portfolio. 1520 1521 Parameters 1522 ---------- 1523 apikey: str 1524 API key provided by Boosted. This key should be protected as a secret. 1525 portfolio_id: str 1526 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1527 proxy: str 1528 Your organization may require the use of a proxy for access. 1529 The address of a HTTPS proxy in the format of <address>:<port>. 1530 Examples are "123.456.789:123" or "my.proxy.com:123". 1531 Do not prepend with "https://". 1532 disable_verify_ssl: bool 1533 Your networking setup may be behind a firewall which performs SSL 1534 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1535 to point to the location of a custom certificate bundle, or set this 1536 parameter to true to disable SSL verification as a workaround. 1537 1538 Returns 1539 ------- 1540 dict: 1541 Dictionary containing signals information: 1542 model_id: str 1543 - Model id from accompanying portfolio 1544 signals: dict 1545 keys: date of the signals in the value 1546 value: list of dict 1547 - List of signal information per model 1548 signals_info: List of dict 1549 - Signal information for each security per model id 1550 company_name: str 1551 - Security name 1552 country: str 1553 - Security exchange region 1554 currency: str 1555 - Security currency 1556 date: str 1557 - Date string in YYYY-MM-DD format of date requested 1558 isin: str 1559 - ISIN of security 1560 signal: float 1561 - Signal from model 1562 signal_delta: float 1563 - Change in signal compared to last trade 1564 symbol: str 1565 - Symbol of the security 1566 """ 1567 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1568 return client.getSignalsForAllDates(portfolio_id)
Get the signals for all dates in the portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing signals information: model_id: str - Model id from accompanying portfolio signals: dict keys: date of the signals in the value value: list of dict - List of signal information per model signals_info: List of dict - Signal information for each security per model id company_name: str - Security name country: str - Security exchange region currency: str - Security currency date: str - Date string in YYYY-MM-DD format of date requested isin: str - ISIN of security signal: float - Signal from model signal_delta: float - Change in signal compared to last trade symbol: str - Symbol of the security
1571def getHistoricalTradeDates( 1572 apikey, portfolio_id, start_date=None, end_date=None, proxy=None, disable_verify_ssl=False 1573): 1574 """ 1575 Get the historical dates for which there exist trading data. 1576 1577 Parameters 1578 ---------- 1579 apikey: str 1580 API key provided by Boosted. This key should be protected as a secret. 1581 portfolio_id: str 1582 Portfolio ID. Portfolio IDs can be retrieved by clicking on the copy to clipboard 1583 button next to your portfolio's name in the Tear Sheet Page of a Model. 1584 start_date: datetime.date or YYYY-MM-DD string 1585 Starting date for the inclusive interval of dates to search. 1586 Defaults to 1 year prior to end date if unspecified. 1587 end_date: datetime.date or YYYY-MM-DD string 1588 Ending date for the inclusive interval of dates to search. 1589 Defaults to today if unspecified. 1590 proxy: str 1591 Your organization may require the use of a proxy for access. 1592 The address of a HTTPS proxy in the format of <address>:<port>. 1593 Examples are "123.456.789:123" or "my.proxy.com:123". 1594 Do not prepend with "https://". 1595 disable_verify_ssl: bool 1596 Your networking setup may be behind a firewall which performs SSL 1597 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1598 to point to the location of a custom certificate bundle, or set this 1599 parameter to true to disable SSL verification as a workaround. 1600 1601 Returns 1602 ------- 1603 dict: 1604 Dictionary containing date information 1605 dates: List of str 1606 List of historical trade dates in YYYY-MM-DD format. 1607 """ 1608 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1609 return client.getHistoricalTradeDates(portfolio_id, start_date, end_date)
Get the historical dates for which there exist trading data.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved by clicking on the copy to clipboard button next to your portfolio's name in the Tear Sheet Page of a Model. start_date: datetime.date or YYYY-MM-DD string Starting date for the inclusive interval of dates to search. Defaults to 1 year prior to end date if unspecified. end_date: datetime.date or YYYY-MM-DD string Ending date for the inclusive interval of dates to search. Defaults to today if unspecified. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing date information dates: List of str List of historical trade dates in YYYY-MM-DD format.
1612def getRankingsForDate( 1613 apikey, 1614 portfolio_id, 1615 date=datetime.date.today(), 1616 rollback_to_last_available_date=False, 1617 proxy=None, 1618 disable_verify_ssl=False, 1619): 1620 """ 1621 Get the rankings data for a portfolio on a date. 1622 1623 Parameters 1624 ---------- 1625 apikey: str 1626 API key provided by Boosted. This key should be protected as a secret. 1627 portfolio_id: str 1628 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1629 date: datetime.date or YYYY-MM-DD string 1630 Date of the universe to retrieve. 1631 rollback_to_last_available_date: bool 1632 Whether or not to retrieve rankings for the most recent date if the current date 1633 is not a trade date. 1634 proxy: str 1635 Your organization may require the use of a proxy for access. 1636 The address of a HTTPS proxy in the format of <address>:<port>. 1637 Examples are "123.456.789:123" or "my.proxy.com:123". 1638 Do not prepend with "https://". 1639 disable_verify_ssl: bool 1640 Your networking setup may be behind a firewall which performs SSL 1641 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1642 to point to the location of a custom certificate bundle, or set this 1643 parameter to true to disable SSL verification as a workaround. 1644 1645 Returns 1646 ------- 1647 Dictionary containing rankings information: 1648 model_id: str 1649 - Model id that the portfolio belongs to 1650 date: str 1651 - Date string in yyyy/mm/dd format of date of the ranking data 1652 rankings: List of dict 1653 - Rankings info per security in the portfolio 1654 symbol: str 1655 - Symbol of the security 1656 isin: str 1657 - The International Securities Identification Number of the security 1658 country: str 1659 - Three character country code 1660 currency: str 1661 - The currency short length code 1662 rank: int 1663 - the ranking from 1 (top) 1664 companyName: str 1665 - The name of the company who owns the security 1666 delta: int 1667 - The change in ranking from the last data point, first will be null 1668 """ 1669 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1670 return client.getRankingsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the rankings data for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary containing rankings information: model_id: str - Model id that the portfolio belongs to date: str - Date string in yyyy/mm/dd format of date of the ranking data rankings: List of dict - Rankings info per security in the portfolio symbol: str - Symbol of the security isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code rank: int - the ranking from 1 (top) companyName: str - The name of the company who owns the security delta: int - The change in ranking from the last data point, first will be null
1673def getRankingsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1674 """ 1675 Get all rankings data for a portfolio. 1676 1677 Parameters 1678 ---------- 1679 apikey: str 1680 API key provided by Boosted. This key should be protected as a secret. 1681 portfolio_id: str 1682 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1683 proxy: str 1684 Your organization may require the use of a proxy for access. 1685 The address of a HTTPS proxy in the format of <address>:<port>. 1686 Examples are "123.456.789:123" or "my.proxy.com:123". 1687 Do not prepend with "https://". 1688 disable_verify_ssl: bool 1689 Your networking setup may be behind a firewall which performs SSL 1690 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1691 to point to the location of a custom certificate bundle, or set this 1692 parameter to true to disable SSL verification as a workaround. 1693 1694 Returns 1695 ------- 1696 Dictionary containing rankings information: 1697 model_id: str 1698 - Model id that the portfolio belongs to 1699 rankings: dict 1700 keys: dates requested in yyyy/mm/dd format, model_id 1701 value: list of dict 1702 - Rankings info per security in the portfolio 1703 symbol: str 1704 - Symbol of the security 1705 isin: str 1706 - The International Securities Identification Number of the security 1707 country: str 1708 - Three character country code 1709 currency: str 1710 - The currency short length code 1711 rank: int 1712 - the ranking from 1 (top) 1713 companyName: str 1714 - The name of the company who owns the security 1715 delta: int 1716 - The change in ranking from the last data point, first will be null 1717 """ 1718 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1719 return client.getRankingsForAllDates(portfolio_id)
Get all rankings data for a portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary containing rankings information: model_id: str - Model id that the portfolio belongs to rankings: dict keys: dates requested in yyyy/mm/dd format, model_id value: list of dict - Rankings info per security in the portfolio symbol: str - Symbol of the security isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code rank: int - the ranking from 1 (top) companyName: str - The name of the company who owns the security delta: int - The change in ranking from the last data point, first will be null
1722def createSignalsModel( 1723 apikey, upload_data, model_name="SignalsUploadModel", proxy=None, disable_verify_ssl=False 1724): 1725 """ 1726 Create a new model with uploaded signals. The model may take a while to 1727 process asynchronously after this method returns. 1728 1729 Parameters 1730 ---------- 1731 apikey: str 1732 API key provided by Boosted. This key should be protected as a secret. 1733 upload_data: pandas.DataFrame 1734 Pandas DataFrame containing your data. The index must be 1735 DatetimeIndex. The first columns must be ISIN, Country, Currency by 1736 default. The remaining column must be the weight. 1737 model_name: str 1738 Name for this model. 1739 proxy: str 1740 Your organization may require the use of a proxy for access. 1741 The address of a HTTPS proxy in the format of <address>:<port>. 1742 Examples are "123.456.789:123" or "my.proxy.com:123". 1743 Do not prepend with "https://". 1744 disable_verify_ssl: bool 1745 Your networking setup may be behind a firewall which performs SSL 1746 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1747 to point to the location of a custom certificate bundle, or set this 1748 parameter to true to disable SSL verification as a workaround. 1749 1750 Returns 1751 ------- 1752 2-tuple 1753 str 1754 Model ID of the newly created model with uploaded signals. 1755 list of str 1756 Warnings incurred while uploading the allocations data. 1757 """ 1758 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1759 return client.createSignalsModel(upload_data, model_name)
Create a new model with uploaded signals. The model may take a while to process asynchronously after this method returns.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. upload_data: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. The remaining column must be the weight. model_name: str Name for this model. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
2-tuple str Model ID of the newly created model with uploaded signals. list of str Warnings incurred while uploading the allocations data.
1762def addSignalsToUploadedModel( 1763 apikey, 1764 model_id, 1765 upload_data, 1766 proxy=None, 1767 disable_verify_ssl=False, 1768 recalc_all=False, 1769 recalc_portfolio_ids=None, 1770): 1771 """ 1772 Add allocations to a previously created uploaded model, then update the most recently accessed 1773 portfolio in the model, or update based on the recalc_all/recalc_portfolio_ids parameters. 1774 The model may take a while to process asynchronously after this method returns. 1775 1776 Parameters 1777 ---------- 1778 apikey: str 1779 API key provided by Boosted. This key should be protected as a secret. 1780 model_id: str 1781 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1782 button next to your model's name in the Model Summary Page in Boosted 1783 Insights. 1784 upload_data: pandas.DataFrame 1785 Pandas DataFrame containing your data. The index must be 1786 DatetimeIndex. The first columns must be ISIN, Country, Currency by 1787 default. The remaining column must be the weight. 1788 proxy: str 1789 Your organization may require the use of a proxy for access. 1790 The address of a HTTPS proxy in the format of <address>:<port>. 1791 Examples are "123.456.789:123" or "my.proxy.com:123". 1792 Do not prepend with "https://". 1793 disable_verify_ssl: bool 1794 Your networking setup may be behind a firewall which performs SSL 1795 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1796 to point to the location of a custom certificate bundle, or set this 1797 parameter to true to disable SSL verification as a workaround. 1798 recalc_all: bool 1799 Set to True to recalculate all portfolios under the model after uploading the allocations. 1800 Otherwise if not set to True, the most recently-accessed portfolio in the model is updated, 1801 or if provided, the list of portfolios provided in recalc_portfolio_ids will be updated. 1802 recalc_portfolio_ids: List[str] 1803 Specify a list of portfolio IDs to recalculate after uploading the allocations. 1804 Portfolio IDs can be retrieved from portfolio's configuration page. 1805 1806 Returns 1807 ------- 1808 list of str 1809 Warnings incurred while uploading the allocations data. 1810 """ 1811 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1812 return client.addSignalsToUploadedModel( 1813 model_id, upload_data, recalc_all=recalc_all, recalc_portfolio_ids=recalc_portfolio_ids 1814 )
Add allocations to a previously created uploaded model, then update the most recently accessed portfolio in the model, or update based on the recalc_all/recalc_portfolio_ids parameters. The model may take a while to process asynchronously after this method returns.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. upload_data: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. The remaining column must be the weight. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
list of str Warnings incurred while uploading the allocations data.
1817def getSignalsFromUploadedModelForDate( 1818 apikey, model_id, date=datetime.date.today(), proxy=None, disable_verify_ssl=False 1819): 1820 """ 1821 Retrieve uploaded signal information for a uploaded model for one date. 1822 1823 Parameters 1824 ---------- 1825 apikey: str 1826 API key provided by Boosted. This key should be protected as a secret. 1827 model_id: str 1828 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1829 button next to your model's name in the Model Summary Page in Boosted 1830 Insights. 1831 date: datetime.date or YYYY-MM-DD string 1832 Date of the universe to retrieve. 1833 proxy: str 1834 Your organization may require the use of a proxy for access. 1835 The address of a HTTPS proxy in the format of <address>:<port>. 1836 Examples are "123.456.789:123" or "my.proxy.com:123". 1837 Do not prepend with "https://". 1838 disable_verify_ssl: bool 1839 Your networking setup may be behind a firewall which performs SSL 1840 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1841 to point to the location of a custom certificate bundle, or set this 1842 parameter to true to disable SSL verification as a workaround. 1843 1844 Returns 1845 ------- 1846 List of signal information 1847 date: str 1848 - Date string in yyyy/mm/dd format of date requested 1849 isin: str 1850 - The International Securities Identification Number of the security 1851 country: str 1852 - Three character country code 1853 currency: str 1854 - The currency short length code 1855 weight: float 1856 - signal value 1857 """ 1858 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1859 return client.getSignalsFromUploadedModel(model_id, date)
Retrieve uploaded signal information for a uploaded model for one date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
List of signal information date: str - Date string in yyyy/mm/dd format of date requested isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code weight: float - signal value
1862def getSignalsFromUploadedModelForAllDates(apikey, model_id, proxy=None, disable_verify_ssl=False): 1863 """ 1864 Retrieve uploaded signal information for a uploaded model for all dates. 1865 1866 Parameters 1867 ---------- 1868 apikey: str 1869 API key provided by Boosted. This key should be protected as a secret. 1870 model_id: str 1871 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1872 button next to your model's name in the Model Summary Page in Boosted 1873 Insights. 1874 proxy: str 1875 Your organization may require the use of a proxy for access. 1876 The address of a HTTPS proxy in the format of <address>:<port>. 1877 Examples are "123.456.789:123" or "my.proxy.com:123". 1878 Do not prepend with "https://". 1879 disable_verify_ssl: bool 1880 Your networking setup may be behind a firewall which performs SSL 1881 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1882 to point to the location of a custom certificate bundle, or set this 1883 parameter to true to disable SSL verification as a workaround. 1884 1885 Returns 1886 ------- 1887 List of signal information 1888 date: str 1889 - Date string in yyyy/mm/dd format of date requested 1890 isin: str 1891 - The International Securities Identification Number of the security 1892 country: str 1893 - Three character country code 1894 currency: str 1895 - The currency short length code 1896 weight: float 1897 - signal value 1898 """ 1899 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1900 return client.getSignalsFromUploadedModel(model_id)
Retrieve uploaded signal information for a uploaded model for all dates.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
List of signal information date: str - Date string in yyyy/mm/dd format of date requested isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code weight: float - signal value
1903def createPortfolioWithPortfolioSettings( 1904 apikey, 1905 model_id, 1906 portfolio_name, 1907 portfolio_description, 1908 portfolio_settings, 1909 proxy=None, 1910 disable_verify_ssl=False, 1911): 1912 """ 1913 Create a portfolio for a model, based on provided portfolio settings. 1914 Specific portfolio settings will fall back to defaults if not provided, and 1915 no two portfolios on the same model may have the exact same set of settings. 1916 Unspecified portfolio settings keys will be defaulted to their model default values. 1917 The portfolio will be asynchronously processed/recalculated and will be available within 1918 5-10 minutes. 1919 1920 Parameters 1921 ---------- 1922 apikey: str 1923 API key provided by Boosted. This key should be protected as a secret. 1924 model_id: str 1925 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1926 button next to your model's name in the Model Summary Page in Boosted 1927 Insights. 1928 portfolio_name: str 1929 Name of the new portfolio. Must be <= 20 characters. 1930 portfolio_description: str 1931 Description for the new portfolio. Must be <= 100 characters. 1932 portfolio_settings: boosted.api.api_type.PortfolioSettings 1933 A pre-configured PortfolioSettings dict. 1934 proxy: str 1935 Your organization may require the use of a proxy for access. 1936 The address of a HTTPS proxy in the format of <address>:<port>. 1937 Examples are "123.456.789:123" or "my.proxy.com:123". 1938 Do not prepend with "https://". 1939 disable_verify_ssl: bool 1940 Your networking setup may be behind a firewall which performs SSL 1941 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1942 to point to the location of a custom certificate bundle, or set this 1943 parameter to true to disable SSL verification as a workaround. 1944 1945 Returns 1946 ------- 1947 str 1948 Portfolio ID of the newly created portfolio. 1949 """ 1950 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1951 return client.createPortfolioWithPortfolioSettings( 1952 model_id, portfolio_name, portfolio_description, portfolio_settings 1953 )
Create a portfolio for a model, based on provided portfolio settings. Specific portfolio settings will fall back to defaults if not provided, and no two portfolios on the same model may have the exact same set of settings. Unspecified portfolio settings keys will be defaulted to their model default values. The portfolio will be asynchronously processed/recalculated and will be available within 5-10 minutes.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_name: str Name of the new portfolio. Must be <= 20 characters. portfolio_description: str Description for the new portfolio. Must be <= 100 characters. portfolio_settings: boosted.api.api_type.PortfolioSettings A pre-configured PortfolioSettings dict. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Portfolio ID of the newly created portfolio.
1956def getPortfolioSettings(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1957 """ 1958 Retrieve portfolio settings from an existing portfolio. The result can be modified and 1959 reused to create a new portfolio. The set of returned portfolio settings are limited 1960 to a view of ones editable as documented in `boosted.api.api_type.PortfolioSettings` only. 1961 1962 Parameters 1963 ---------- 1964 apikey: str 1965 API key provided by Boosted. This key should be protected as a secret. 1966 portfolio_id: str 1967 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1968 proxy: str 1969 Your organization may require the use of a proxy for access. 1970 The address of a HTTPS proxy in the format of <address>:<port>. 1971 Examples are "123.456.789:123" or "my.proxy.com:123". 1972 Do not prepend with "https://". 1973 disable_verify_ssl: bool 1974 Your networking setup may be behind a firewall which performs SSL 1975 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1976 to point to the location of a custom certificate bundle, or set this 1977 parameter to true to disable SSL verification as a workaround. 1978 1979 Returns 1980 ------- 1981 boosted.api.api_type.PortfolioSettings 1982 A PortfolioSettings can be used to create a new portfolio. 1983 """ 1984 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1985 return client.getPortfolioSettings(portfolio_id)
Retrieve portfolio settings from an existing portfolio. The result can be modified and
reused to create a new portfolio. The set of returned portfolio settings are limited
to a view of ones editable as documented in boosted.api.api_type.PortfolioSettings
only.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
boosted.api.api_type.PortfolioSettings A PortfolioSettings can be used to create a new portfolio.
1988def getGbiIdFromIsinCountryCurrencyDate( 1989 apikey, isin_country_currency_dates, proxy=None, disable_verify_ssl=False 1990): 1991 """ 1992 Get the gbi securities from a isin, country, currency, date combinations 1993 1994 Parameters 1995 ---------- 1996 apikey: str 1997 API key provided by Boosted. This key should be protected as a secret. 1998 isin_country_currency_dates: list of IsinCountryCurrencyDate 1999 An array of IsinCountryCurrencyDate 2000 proxy: str 2001 Your organization may require the use of a proxy for access. 2002 The address of a HTTPS proxy in the format of <address>:<port>. 2003 Examples are "123.456.789:123" or "my.proxy.com:123". 2004 Do not prepend with "https://". 2005 disable_verify_ssl: bool 2006 Your networking setup may be behind a firewall which performs SSL 2007 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2008 to point to the location of a custom certificate bundle, or set this 2009 parameter to true to disable SSL verification as a workaround. 2010 2011 Returns 2012 ------- 2013 list of GbiIdSecurity 2014 The corresponding gbi id securities 2015 """ 2016 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2017 return client.getGbiIdFromIsinCountryCurrencyDate(isin_country_currency_dates)
Get the gbi securities from a isin, country, currency, date combinations
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin_country_currency_dates: list of IsinCountryCurrencyDate An array of IsinCountryCurrencyDate proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
list of GbiIdSecurity The corresponding gbi id securities
2020def getDatasetDates(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 2021 """ 2022 Gets the valid to and valid from dates of the given dataset id 2023 2024 Parameters 2025 ---------- 2026 apikey: str 2027 API key provided by Boosted. This key should be protected as a secret. 2028 dataset_id: str 2029 Dataset ID. Can be from the output of addDependentDataset or be found 2030 in your Custom Data listing in Boosted Insights. 2031 proxy: str 2032 Your organization may require the use of a proxy for access. 2033 The address of a HTTPS proxy in the format of <address>:<port>. 2034 Examples are "123.456.789:123" or "my.proxy.com:123". 2035 Do not prepend with "https://". 2036 disable_verify_ssl: bool 2037 Your networking setup may be behind a firewall which performs SSL 2038 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2039 to point to the location of a custom certificate bundle, or set this 2040 parameter to true to disable SSL verification as a workaround. 2041 2042 Returns 2043 ------- 2044 dict: 2045 Dictionary containing the valid to and from dates of the dataset 2046 { 2047 'validFrom': datetime.date, 2048 'validTo': datetime.date 2049 } 2050 ___ 2051 """ 2052 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2053 return client.getDatasetDates(dataset_id)
Gets the valid to and valid from dates of the given dataset id
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing the valid to and from dates of the dataset { 'validFrom': datetime.date, 'validTo': datetime.date }
2056def getRankingAnalysis(apikey, model_id, date, proxy=None, disable_verify_ssl=False): 2057 """ 2058 Gets the ranking 2.0 analysis data for the given model on the given date 2059 2060 Parameters 2061 ---------- 2062 apikey: str 2063 API key provided by Boosted. This key should be protected as a secret. 2064 model_id: str 2065 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2066 button next to your model's name in the Model Summary Page in Boosted 2067 Insights. 2068 date: datetime.date or YYYY-MM-DD string 2069 Date of the data to retrieve. 2070 proxy: str 2071 Your organization may require the use of a proxy for access. 2072 The address of a HTTPS proxy in the format of <address>:<port>. 2073 Examples are "123.456.789:123" or "my.proxy.com:123". 2074 Do not prepend with "https://". 2075 disable_verify_ssl: bool 2076 Your networking setup may be behind a firewall which performs SSL 2077 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2078 to point to the location of a custom certificate bundle, or set this 2079 parameter to true to disable SSL verification as a workaround. 2080 2081 Returns 2082 ------- 2083 pandas.DataFrame 2084 Pandas DataFrame containing your data indexed by data buckets and feature names. 2085 ___ 2086 """ 2087 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2088 return client.getRankingAnalysis(model_id, date)
Gets the ranking 2.0 analysis data for the given model on the given date
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data indexed by data buckets and feature names.
2091def getRankingExplain( 2092 apikey, 2093 model_id, 2094 date, 2095 proxy=None, 2096 disable_verify_ssl=False, 2097 index_by_symbol: bool = False, 2098 index_by_all_metadata: bool = False, 2099): 2100 """ 2101 Gets the ranking 2.0 explain data for the given model on the given date 2102 2103 Parameters 2104 ---------- 2105 apikey: str 2106 API key provided by Boosted. This key should be protected as a secret. 2107 model_id: str 2108 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2109 button next to your model's name in the Model Summary Page in Boosted 2110 Insights. 2111 date: datetime.date or YYYY-MM-DD string 2112 Date of the data to retrieve. 2113 proxy: str 2114 Your organization may require the use of a proxy for access. 2115 The address of a HTTPS proxy in the format of <address>:<port>. 2116 Examples are "123.456.789:123" or "my.proxy.com:123". 2117 Do not prepend with "https://". 2118 disable_verify_ssl: bool 2119 Your networking setup may be behind a firewall which performs SSL 2120 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2121 to point to the location of a custom certificate bundle, or set this 2122 parameter to true to disable SSL verification as a workaround. 2123 index_by_symbol: bool 2124 If true, index by stock symbol instead of ISIN. 2125 index_by_all_metadata: bool 2126 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2127 Overrides index_by_symbol. 2128 2129 Returns 2130 ------- 2131 pandas.DataFrame 2132 Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata 2133 and feature names. 2134 ___ 2135 """ 2136 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2137 return client.getRankingExplain( 2138 model_id, date, index_by_symbol=index_by_symbol, index_by_all_metadata=index_by_all_metadata 2139 )
Gets the ranking 2.0 explain data for the given model on the given date
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata and feature names.
2142def getExplainForPortfolio( 2143 apikey, 2144 model_id, 2145 portfolio_id, 2146 date, 2147 proxy=None, 2148 disable_verify_ssl=False, 2149 index_by_symbol: bool = False, 2150 index_by_all_metadata: bool = False, 2151): 2152 """ 2153 Gets the ranking 2.0 explain data for the given model on the given date, 2154 filtered by portfolio. 2155 2156 Parameters 2157 ---------- 2158 apikey: str 2159 API key provided by Boosted. This key should be protected as a secret. 2160 model_id: str 2161 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2162 button next to your model's name in the Model Summary Page in Boosted 2163 Insights. 2164 portfolio_id: str 2165 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2166 date: datetime.date or YYYY-MM-DD string 2167 Date of the data to retrieve. 2168 proxy: str 2169 Your organization may require the use of a proxy for access. 2170 The address of a HTTPS proxy in the format of <address>:<port>. 2171 Examples are "123.456.789:123" or "my.proxy.com:123". 2172 Do not prepend with "https://". 2173 disable_verify_ssl: bool 2174 Your networking setup may be behind a firewall which performs SSL 2175 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2176 to point to the location of a custom certificate bundle, or set this 2177 parameter to true to disable SSL verification as a workaround. 2178 index_by_symbol: bool 2179 If true, index by stock symbol instead of ISIN. 2180 index_by_all_metadata: bool 2181 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2182 Overrides index_by_symbol. 2183 2184 Returns 2185 ------- 2186 pandas.DataFrame 2187 Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata 2188 and feature names, filtered by portfolio. 2189 ___ 2190 """ 2191 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2192 return client.getExplainForPortfolio( 2193 model_id, 2194 portfolio_id, 2195 date, 2196 index_by_symbol=index_by_symbol, 2197 index_by_all_metadata=index_by_all_metadata, 2198 )
Gets the ranking 2.0 explain data for the given model on the given date, filtered by portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata and feature names, filtered by portfolio.
2201def getDenseSignalsForDate( 2202 apikey, 2203 portfolio_id, 2204 date=datetime.date.today(), 2205 rollback_to_last_available_date=False, 2206 proxy=None, 2207 disable_verify_ssl=False, 2208): 2209 """ 2210 Get the dense signals for a portfolio on a date. 2211 2212 Parameters 2213 ---------- 2214 apikey: str 2215 API key provided by Boosted. This key should be protected as a secret. 2216 portfolio_id: str 2217 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2218 date: datetime.date or YYYY-MM-DD string 2219 Date of the signals to retrieve. 2220 rollback_to_last_available_date: bool 2221 Whether or not to retrieve signals for the most recent date if the current date 2222 is not a trade date. 2223 proxy: str 2224 Your organization may require the use of a proxy for access. 2225 The address of a HTTPS proxy in the format of <address>:<port>. 2226 Examples are "123.456.789:123" or "my.proxy.com:123". 2227 Do not prepend with "https://". 2228 disable_verify_ssl: bool 2229 Your networking setup may be behind a firewall which performs SSL 2230 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2231 to point to the location of a custom certificate bundle, or set this 2232 parameter to true to disable SSL verification as a workaround. 2233 2234 Returns 2235 ------- 2236 dict: 2237 Dictionary containing signals information: 2238 date: str 2239 - Date string in YYYY-MM-DD format of date of the signal data 2240 signals: List of dict 2241 - List of signal information per model 2242 model_id: str 2243 - Model id from accompanying portfolio 2244 signals_info: List of dict 2245 - Signal information for each security per model id 2246 allocation: float 2247 - Allocation in the portfolio 2248 company_name: str 2249 - Security name 2250 country: str 2251 - Security exchange region 2252 currency: str 2253 - Security currency 2254 date: str 2255 - Date of the signal data 2256 isin: str 2257 - ISIN of security 2258 quantile: int 2259 - Quantile from 1 to 5 2260 scaled_signal: float 2261 - Scaled signal 2262 signal: float 2263 - Signal from model 2264 symbol: str 2265 - Symbol of the security 2266 """ 2267 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2268 return client.getDenseSignalsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the dense signals for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the signals to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve signals for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing signals information: date: str - Date string in YYYY-MM-DD format of date of the signal data signals: List of dict - List of signal information per model model_id: str - Model id from accompanying portfolio signals_info: List of dict - Signal information for each security per model id allocation: float - Allocation in the portfolio company_name: str - Security name country: str - Security exchange region currency: str - Security currency date: str - Date of the signal data isin: str - ISIN of security quantile: int - Quantile from 1 to 5 scaled_signal: float - Scaled signal signal: float - Signal from model symbol: str - Symbol of the security
2271def getDenseSignals( 2272 apikey, 2273 model_id, 2274 portfolio_id, 2275 file_name=None, 2276 location="./", 2277 proxy=None, 2278 disable_verify_ssl=False, 2279): 2280 """ 2281 Downloads the dense signal csv for the provided portfolio and model 2282 2283 Parameters 2284 ---------- 2285 apikey: str 2286 API key provided by Boosted. This key should be protected as a secret. 2287 model_id: str 2288 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2289 button next to your model's name in the Model Summary Page in Boosted 2290 Insights. 2291 portfolio_id: str 2292 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2293 file_name: str 2294 File name of the dense signals file to save as. 2295 If no file name is given the file name will be "<model_id>-<portfolio_id>_dense_signals.csv" 2296 location: str 2297 The location to save the file to. 2298 If no location is given then it will be saved to the current directory. 2299 proxy: str 2300 Your organization may require the use of a proxy for access. 2301 The address of a HTTPS proxy in the format of <address>:<port>. 2302 Examples are "123.456.789:123" or "my.proxy.com:123". 2303 Do not prepend with "https://". 2304 disable_verify_ssl: bool 2305 Your networking setup may be behind a firewall which performs SSL 2306 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2307 to point to the location of a custom certificate bundle, or set this 2308 parameter to true to disable SSL verification as a workaround. 2309 2310 Returns 2311 ------- 2312 None 2313 ___ 2314 """ 2315 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2316 return client.getDenseSignals(model_id, portfolio_id, file_name, location)
Downloads the dense signal csv for the provided portfolio and model
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
model_id: str
Model ID. Model IDs can be retrieved by clicking on the copy to clipboard
button next to your model's name in the Model Summary Page in Boosted
Insights.
portfolio_id: str
Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page.
file_name: str
File name of the dense signals file to save as.
If no file name is given the file name will be "
Returns
None
2319def getRanking2DateAnalysisFile( 2320 apikey, 2321 model_id, 2322 portfolio_id, 2323 date, 2324 file_name=None, 2325 location="./", 2326 proxy=None, 2327 disable_verify_ssl=False, 2328): 2329 """ 2330 Downloads the ranking analysis file for the provied portfolio and model. 2331 If no file exist then it will send a request to generate the file and continuously 2332 poll the server every 5 seconds to try and download the file until the file is downloaded. 2333 2334 Parameters 2335 ---------- 2336 apikey: str 2337 API key provided by Boosted. This key should be protected as a secret. 2338 model_id: str 2339 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2340 button next to your model's name in the Model Summary Page in Boosted 2341 Insights. 2342 portfolio_id: str 2343 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2344 date: datetime.date or YYYY-MM-DD string 2345 Date of the data to retrieve. 2346 file_name: str 2347 File name of the dense signals file to save as. 2348 If no file name is given the file name will be 2349 "<model_id>-<portfolio_id>_statistical_analysis_<date>.xlsx" 2350 location: str 2351 The location to save the file to. 2352 If no location is given then it will be saved to the current directory. 2353 proxy: str 2354 Your organization may require the use of a proxy for access. 2355 The address of a HTTPS proxy in the format of <address>:<port>. 2356 Examples are "123.456.789:123" or "my.proxy.com:123". 2357 Do not prepend with "https://". 2358 disable_verify_ssl: bool 2359 Your networking setup may be behind a firewall which performs SSL 2360 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2361 to point to the location of a custom certificate bundle, or set this 2362 parameter to true to disable SSL verification as a workaround. 2363 2364 Returns 2365 ------- 2366 None 2367 ___ 2368 """ 2369 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2370 return client.getRanking2DateAnalysisFile(model_id, portfolio_id, date, file_name, location)
Downloads the ranking analysis file for the provied portfolio and model. If no file exist then it will send a request to generate the file and continuously poll the server every 5 seconds to try and download the file until the file is downloaded.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
model_id: str
Model ID. Model IDs can be retrieved by clicking on the copy to clipboard
button next to your model's name in the Model Summary Page in Boosted
Insights.
portfolio_id: str
Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page.
date: datetime.date or YYYY-MM-DD string
Date of the data to retrieve.
file_name: str
File name of the dense signals file to save as.
If no file name is given the file name will be
"
Returns
None
2373def getRanking2DateExplainFile( 2374 apikey, 2375 model_id, 2376 portfolio_id, 2377 date, 2378 file_name=None, 2379 location="./", 2380 proxy=None, 2381 disable_verify_ssl=False, 2382 overwrite: bool = False, 2383 index_by_all_metadata: bool = False, 2384): 2385 """ 2386 Downloads the ranking explain file for the provided portfolio and model. 2387 If no file exist then it will send a request to generate the file and continuously 2388 poll the server every 5 seconds to try and download the file until the file is downloaded. 2389 2390 Parameters 2391 ---------- 2392 apikey: str 2393 API key provided by Boosted. This key should be protected as a secret. 2394 model_id: str 2395 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2396 button next to your model's name in the Model Summary Page in Boosted 2397 Insights. 2398 portfolio_id: str 2399 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2400 date: datetime.date or YYYY-MM-DD string 2401 Date of the data to retrieve. 2402 file_name: str 2403 File name of the dense signals file to save as. 2404 If no file name is given the file name will be 2405 "<model_id>-<portfolio_id>_explain_data_<date>.xlsx" 2406 location: str 2407 The location to save the file to. 2408 If no location is given then it will be saved to the current directory. 2409 proxy: str 2410 Your organization may require the use of a proxy for access. 2411 The address of a HTTPS proxy in the format of <address>:<port>. 2412 Examples are "123.456.789:123" or "my.proxy.com:123". 2413 Do not prepend with "https://". 2414 disable_verify_ssl: bool 2415 Your networking setup may be behind a firewall which performs SSL 2416 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2417 to point to the location of a custom certificate bundle, or set this 2418 parameter to true to disable SSL verification as a workaround. 2419 overwrite: bool 2420 Defaults to False, set to True to regenerate the file. 2421 index_by_all_metadata: bool 2422 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2423 2424 2425 Returns 2426 ------- 2427 None 2428 ___ 2429 """ 2430 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2431 return client.getRanking2DateExplainFile( 2432 model_id, 2433 portfolio_id, 2434 date, 2435 file_name, 2436 location, 2437 overwrite, 2438 index_by_all_metadata, 2439 )
Downloads the ranking explain file for the provided portfolio and model. If no file exist then it will send a request to generate the file and continuously poll the server every 5 seconds to try and download the file until the file is downloaded.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
model_id: str
Model ID. Model IDs can be retrieved by clicking on the copy to clipboard
button next to your model's name in the Model Summary Page in Boosted
Insights.
portfolio_id: str
Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page.
date: datetime.date or YYYY-MM-DD string
Date of the data to retrieve.
file_name: str
File name of the dense signals file to save as.
If no file name is given the file name will be
"
Returns
None
2442def getRanking2DateExplain( 2443 apikey: str, 2444 model_id: str, 2445 portfolio_id: str, 2446 date: BoostedDate, 2447 overwrite: bool = False, 2448 proxy: Optional[str] = None, 2449 disable_verify_ssl: bool = False, 2450) -> Dict[str, pd.DataFrame]: 2451 """ 2452 Downloads the ranking explain file for the provied portfolio and model and 2453 loads it into a dict of pandas dataframes. If no file exists then it will 2454 send a request to generate the file and continuously poll the server every 5 2455 seconds to try and download the file until the file is downlodded. 2456 2457 Parameters 2458 ---------- 2459 apikey: str 2460 API key provided by Boosted. This key should be protected as a secret. 2461 model_id: str 2462 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2463 button next to your model's name in the Model Summary Page in Boosted 2464 Insights. 2465 portfolio_id: str 2466 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2467 date: datetime.date or YYYY-MM-DD string 2468 Date of the data to retrieve. 2469 overwrite: bool 2470 Defaults to False, set to True to regenerate the file. 2471 proxy: str 2472 Your organization may require the use of a proxy for access. 2473 The address of a HTTPS proxy in the format of <address>:<port>. 2474 Examples are "123.456.789:123" or "my.proxy.com:123". 2475 Do not prepend with "https://". 2476 disable_verify_ssl: bool 2477 Your networking setup may be behind a firewall which performs SSL 2478 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2479 to point to the location of a custom certificate bundle, or set this 2480 parameter to true to disable SSL verification as a workaround. 2481 2482 Returns 2483 ------- 2484 A dict with excel sheet names as keys, and Pandas dataframe, indexed by 2485 symbol, as values. 2486 ___ 2487 """ 2488 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2489 return client.getRanking2DateExplain(model_id, portfolio_id, convert_date(date), overwrite)
Downloads the ranking explain file for the provied portfolio and model and loads it into a dict of pandas dataframes. If no file exists then it will send a request to generate the file and continuously poll the server every 5 seconds to try and download the file until the file is downlodded.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. overwrite: bool Defaults to False, set to True to regenerate the file. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dict with excel sheet names as keys, and Pandas dataframe, indexed by symbol, as values.
2492def getTearSheet( 2493 apikey, 2494 model_id, 2495 portfolio_id, 2496 proxy=None, 2497 disable_verify_ssl=False, 2498 start_date=None, 2499 end_date=None, 2500 block=False, 2501): 2502 """ 2503 Gets the model and portfolio's tear sheet and returns it as a list of tear sheet groups 2504 2505 Parameters 2506 ---------- 2507 apikey: str 2508 API key provided by Boosted. This key should be protected as a secret. 2509 model_id: str 2510 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2511 button next to your model's name in the Model Summary Page in Boosted 2512 Insights. 2513 portfolio_id: str 2514 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2515 start_date: str or None 2516 Start date for the range of data represented by the tear sheet (YYYY-MM-DD) 2517 end_date: str or None 2518 End date for the range of data represented by the tear sheet (YYYY-MM-DD) 2519 Must be None if and only if start_date is None 2520 block: bool 2521 Whether or not to wait for the data to be ready. No effect if dates are not 2522 provided 2523 Returns 2524 ------- 2525 List 2526 Each element in the list represents a group in the tearsheet. i.e Risk Adjusted Returns 2527 Each dictionary is made of member which is a list of dicts representing a tearsheet 2528 value and a group name which is the name of the group shown on screen. Each dict in 2529 the member array has value which is a floating point number, type which is either 2530 "number" or "precent" to determine if value is a raw number or a percentage value, 2531 and finally "name" which is the name shown on screen. 2532 [ 2533 { 2534 members: [ 2535 { 2536 "value": float, 2537 "type": str, 2538 "name": str 2539 }, 2540 ], 2541 group_name: str 2542 }, 2543 ] 2544 ___ 2545 """ 2546 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2547 return client.getTearSheet( 2548 model_id, portfolio_id, start_date=start_date, end_date=end_date, block=block 2549 )
Gets the model and portfolio's tear sheet and returns it as a list of tear sheet groups
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. start_date: str or None Start date for the range of data represented by the tear sheet (YYYY-MM-DD) end_date: str or None End date for the range of data represented by the tear sheet (YYYY-MM-DD) Must be None if and only if start_date is None block: bool Whether or not to wait for the data to be ready. No effect if dates are not provided
Returns
List Each element in the list represents a group in the tearsheet. i.e Risk Adjusted Returns Each dictionary is made of member which is a list of dicts representing a tearsheet value and a group name which is the name of the group shown on screen. Each dict in the member array has value which is a floating point number, type which is either "number" or "precent" to determine if value is a raw number or a percentage value, and finally "name" which is the name shown on screen. [ { members: [ { "value": float, "type": str, "name": str }, ], group_name: str }, ]
2552def getPortfolioStatus( 2553 apikey, 2554 model_id, 2555 portfolio_id, 2556 job_date, 2557 proxy=None, 2558 disable_verify_ssl=False, 2559): 2560 """ 2561 Gets the update status of a portfolio 2562 2563 Parameters 2564 ---------- 2565 model_id: str 2566 The id of the model the portfolio belongs to 2567 portfolio_id: str 2568 The id of the portfolio 2569 job_date: str 2570 The date in question, in YYYY-MM-DD format 2571 Returns 2572 ------- 2573 dict with properties 2574 is_complete: bool 2575 True if the calculation for the date has been completed 2576 last_update: str 2577 The most recent date with a completed calculation 2578 next_update: str 2579 The earliest date (in the future) with an incomplete calculation 2580 ___ 2581 """ 2582 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2583 return client.getPortfolioStatus(model_id, portfolio_id, job_date)
Gets the update status of a portfolio
Parameters
model_id: str The id of the model the portfolio belongs to portfolio_id: str The id of the portfolio job_date: str The date in question, in YYYY-MM-DD format
Returns
dict with properties is_complete: bool True if the calculation for the date has been completed last_update: str The most recent date with a completed calculation next_update: str The earliest date (in the future) with an incomplete calculation
2586def getBlacklist( 2587 apikey, 2588 blacklist_id, 2589 proxy=None, 2590 disable_verify_ssl=False, 2591): 2592 """ 2593 Gets blacklist with provided id. You must have access to the blacklist. 2594 2595 Parameters 2596 ---------- 2597 blacklist_id: int 2598 Blacklist ID. Blacklist ID can be found by running getBlacklists, or 2599 when you create a blacklist the ID of the created blacklist will be shown. 2600 2601 Returns 2602 ------- 2603 Blacklist 2604 ___ 2605 """ 2606 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2607 return client.getBlacklist(blacklist_id)
Gets blacklist with provided id. You must have access to the blacklist.
Parameters
blacklist_id: int Blacklist ID. Blacklist ID can be found by running getBlacklists, or when you create a blacklist the ID of the created blacklist will be shown.
Returns
Blacklist
2610def getBlacklists( 2611 apikey, 2612 model_id=None, 2613 company_id=None, 2614 last_N=None, 2615 proxy=None, 2616 disable_verify_ssl=False, 2617): 2618 """ 2619 Gets the list of blacklists with provided company_id or model_id. If last_N is provided, 2620 the list will return N most recently created blacklists. If no parameter is provided, 2621 the list of user company's blacklists will be returned. 2622 Note that when company_id is provided, blacklists will be returned if you have access 2623 to their model, if they are model specified. 2624 company_id and model_id cannot both be provided. 2625 2626 Parameters 2627 ---------- 2628 model_id: str 2629 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2630 button next to your model's name in the Model Summary Page in Boosted 2631 Insights. You must have access to the model. 2632 company_id: str 2633 Company ID. Used by administrators to access blacklists from the given company. 2634 last_N: int 2635 N most recently created blacklists to return 2636 2637 Returns 2638 ------- 2639 list of Blacklists 2640 ___ 2641 """ 2642 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2643 return client.getBlacklists(model_id=model_id, company_id=company_id, last_N=last_N)
Gets the list of blacklists with provided company_id or model_id. If last_N is provided, the list will return N most recently created blacklists. If no parameter is provided, the list of user company's blacklists will be returned. Note that when company_id is provided, blacklists will be returned if you have access to their model, if they are model specified. company_id and model_id cannot both be provided.
Parameters
model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. You must have access to the model. company_id: str Company ID. Used by administrators to access blacklists from the given company. last_N: int N most recently created blacklists to return
Returns
list of Blacklists
2646def createBlacklist( 2647 apikey, 2648 isin, 2649 long_short=2, 2650 start_date=datetime.date.today(), 2651 end_date="4000-01-01", 2652 model_id=None, 2653 proxy=None, 2654 disable_verify_ssl=False, 2655): 2656 """ 2657 Creates a blacklist with ISIN, long_short, start_date and end_date. If model_id is given, 2658 the blacklist will be set for the given model. long_short will default to 2, 2659 start_date will default to today, and end_date will default to 4000-01-01, 2660 unless they are provided. 2661 2662 Parameters 2663 ---------- 2664 isin: string 2665 ISIN of the blacklist to be created 2666 long_short: int 2667 -1: short blacklist only 1: long blacklist only 2: both 2668 start_date: string 2669 The created blacklist will take effect from start_date. 2670 end_date: string 2671 The created blacklist will take effect until end_date. 2672 model_id: str 2673 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2674 button next to your model's name in the Model Summary Page in Boosted 2675 Insights. You must have access to the model. 2676 2677 Returns 2678 ------- 2679 Blacklist 2680 ___ 2681 """ 2682 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2683 return client.createBlacklist( 2684 isin, long_short=long_short, start_date=start_date, end_date=end_date, model_id=model_id 2685 )
Creates a blacklist with ISIN, long_short, start_date and end_date. If model_id is given, the blacklist will be set for the given model. long_short will default to 2, start_date will default to today, and end_date will default to 4000-01-01, unless they are provided.
Parameters
isin: string ISIN of the blacklist to be created long_short: int -1: short blacklist only 1: long blacklist only 2: both start_date: string The created blacklist will take effect from start_date. end_date: string The created blacklist will take effect until end_date. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. You must have access to the model.
Returns
Blacklist
2688def createBlacklistsFromCSV(apikey, csv_name, proxy=None, disable_verify_ssl=False): 2689 """ 2690 Creates blacklists from a csv. CSV must have the following header: 2691 ModelID, ISIN, LongShort, StartDate, EndDate 2692 where StartDate and EndDate are in the form of YYYY-MM-DD 2693 For more information and default behaviours, please refer to createBlacklist. 2694 2695 Parameters 2696 ---------- 2697 csv_name: string 2698 Name of the csv containing blacklists. Csv must be located in the same directory. 2699 2700 Returns 2701 ------- 2702 Blacklists 2703 ___ 2704 """ 2705 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2706 return client.createBlacklistsFromCSV(csv_name)
Creates blacklists from a csv. CSV must have the following header: ModelID, ISIN, LongShort, StartDate, EndDate where StartDate and EndDate are in the form of YYYY-MM-DD For more information and default behaviours, please refer to createBlacklist.
Parameters
csv_name: string Name of the csv containing blacklists. Csv must be located in the same directory.
Returns
Blacklists
2709def updateBlacklist( 2710 apikey, 2711 blacklist_id, 2712 long_short=None, 2713 start_date=None, 2714 end_date=None, 2715 proxy=None, 2716 disable_verify_ssl=False, 2717): 2718 """ 2719 Updates the blacklist with given id. You must have access to the blacklist. 2720 long_short, start_date and end_date are all optional. 2721 2722 Parameters 2723 ---------- 2724 blacklist_id: int 2725 Blacklist ID. Blacklist ID can be found by running getBlacklists, 2726 or when you create a blacklist the ID of the created blacklist will be shown. 2727 long_short: int 2728 -1: short blacklist only 1: long blacklist only 2: both 2729 start_date: string 2730 The created blacklist will take effect from start_date. 2731 end_date: string 2732 The created blacklist will take effect until end_date. 2733 2734 Returns 2735 ------- 2736 Blacklist 2737 ___ 2738 """ 2739 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2740 return client.updateBlacklist( 2741 blacklist_id, long_short=long_short, start_date=start_date, end_date=end_date 2742 )
Updates the blacklist with given id. You must have access to the blacklist. long_short, start_date and end_date are all optional.
Parameters
blacklist_id: int Blacklist ID. Blacklist ID can be found by running getBlacklists, or when you create a blacklist the ID of the created blacklist will be shown. long_short: int -1: short blacklist only 1: long blacklist only 2: both start_date: string The created blacklist will take effect from start_date. end_date: string The created blacklist will take effect until end_date.
Returns
Blacklist
2745def deleteBlacklist( 2746 apikey, 2747 blacklist_id, 2748 proxy=None, 2749 disable_verify_ssl=False, 2750): 2751 """ 2752 Deletes the blacklist with given id. You must have access to the blacklist. 2753 2754 Parameters 2755 ---------- 2756 blacklist_id: int 2757 Blacklist ID. Blacklist ID can be found by running getBlacklists, 2758 or when you create a blacklist the ID of the created blacklist will be shown. 2759 2760 Returns 2761 ------- 2762 Boolean, denoting the success of deletion 2763 ___ 2764 """ 2765 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2766 return client.deleteBlacklist(blacklist_id)
Deletes the blacklist with given id. You must have access to the blacklist.
Parameters
blacklist_id: int Blacklist ID. Blacklist ID can be found by running getBlacklists, or when you create a blacklist the ID of the created blacklist will be shown.
Returns
Boolean, denoting the success of deletion
2769def getFeatureImportance(apikey, model_id, date, N=None, proxy=None, disable_verify_ssl=False): 2770 """ 2771 Gets the top N features for the given model sorted in descending order of importance 2772 2773 Parameters 2774 ---------- 2775 apikey: str 2776 API key provided by Boosted. This key should be protected as a secret. 2777 model_id: str 2778 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2779 button next to your model's name in the Model Summary Page in Boosted 2780 Insights. 2781 date: datetime.date or YYYY-MM-DD string 2782 Date for the period for which features should be fetched. The resulting features 2783 are fetched for the period the date falls into. E.g. if the date is 2021-11-21 for the 2784 annual model, the features will be provided for the period of 2021-01-01 - 2021-12-31. 2785 N: int 2786 Limit for the number of top features to be returned. If not provided, the entire list 2787 of features will be returned. 2788 proxy: str 2789 Your organization may require the use of a proxy for access. 2790 The address of a HTTPS proxy in the format of <address>:<port>. 2791 Examples are "123.456.789:123" or "my.proxy.com:123". 2792 Do not prepend with "https://". 2793 disable_verify_ssl: bool 2794 Your networking setup may be behind a firewall which performs SSL 2795 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2796 to point to the location of a custom certificate bundle, or set this 2797 parameter to true to disable SSL verification as a workaround. 2798 Returns 2799 ------- 2800 pandas.DataFrame 2801 Pandas DataFrame containing features and their importance 2802 ___ 2803 """ 2804 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2805 return client.getFeatureImportance(model_id, date, N)
Gets the top N features for the given model sorted in descending order of importance
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date for the period for which features should be fetched. The resulting features are fetched for the period the date falls into. E.g. if the date is 2021-11-21 for the annual model, the features will be provided for the period of 2021-01-01 - 2021-12-31. N: int Limit for the number of top features to be returned. If not provided, the entire list of features will be returned. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing features and their importance
2808def getAllModelNames( 2809 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2810) -> Dict[str, str]: 2811 """ 2812 Gets the model names for all models the user has access to. 2813 Parameters 2814 ---------- 2815 apikey: str 2816 API key provided by Boosted. This key should be protected as a secret. 2817 proxy: Optional[str] 2818 Your organization may require the use of a proxy for access. 2819 The address of a HTTPS proxy in the format of <address>:<port>. 2820 Examples are "123.456.789:123" or "my.proxy.com:123". 2821 Do not prepend with "https://". 2822 disable_verify_ssl: bool = False 2823 Your networking setup may be behind a firewall which performs SSL 2824 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2825 to point to the location of a custom certificate bundle, or set this 2826 parameter to true to disable SSL verification as a workaround. 2827 Returns 2828 ------- 2829 dict: 2830 Dictionary mapping model id to model name. 2831 """ 2832 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2833 return client.getAllModelNames()
Gets the model names for all models the user has access to.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: Optional[str] Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary mapping model id to model name.
2836def getAllModelDetails( 2837 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2838) -> Dict[str, Dict[str, Any]]: 2839 """ 2840 Gets the model name, model id, last update time, and associated portfolio 2841 ids for all models the user has access to. 2842 Parameters 2843 ---------- 2844 apikey: str 2845 API key provided by Boosted. This key should be protected as a secret. 2846 proxy: Optional[str] 2847 Your organization may require the use of a proxy for access. 2848 The address of a HTTPS proxy in the format of <address>:<port>. 2849 Examples are "123.456.789:123" or "my.proxy.com:123". 2850 Do not prepend with "https://". 2851 disable_verify_ssl: bool = False 2852 Your networking setup may be behind a firewall which performs SSL 2853 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2854 to point to the location of a custom certificate bundle, or set this 2855 parameter to true to disable SSL verification as a workaround. 2856 Returns 2857 ------- 2858 Dictionary keyed by model id mapping to nested dictionary with the following values: 2859 portfolios: List[Dict[str, str]] 2860 List of portfolio associated with the model. Each portfolio is a dict 2861 with keys "id" and "name". 2862 name: str 2863 Model name. 2864 last_updated: datetime 2865 Last updated time of the model. 2866 """ 2867 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2868 return client.getAllModelDetails()
Gets the model name, model id, last update time, and associated portfolio ids for all models the user has access to.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: Optional[str] Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary keyed by model id mapping to nested dictionary with the following values: portfolios: List[Dict[str, str]] List of portfolio associated with the model. Each portfolio is a dict with keys "id" and "name". name: str Model name. last_updated: datetime Last updated time of the model.
2871def getEquityAccuracy( 2872 apikey: str, 2873 model_id: str, 2874 portfolio_id: str, 2875 tickers: List[str], 2876 start_date: Optional[BoostedDate] = None, 2877 end_date: Optional[BoostedDate] = None, 2878 proxy: Optional[str] = None, 2879 disable_verify_ssl: bool = False, 2880) -> Dict[str, Dict[str, Any]]: 2881 """ 2882 Retrieves accuracy data for a given portfolio and list of tickers. 2883 Parameters 2884 ---------- 2885 apikey: str 2886 API key provided by Boosted. This key should be protected as a secret. 2887 model_id: str 2888 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2889 button next to your model's name in the Model Summary Page in Boosted 2890 Insights. 2891 portfolio_id: str 2892 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2893 tickers: List[str] 2894 List of tickers to get accuracy information with. 2895 start_date: Optional[datetime | string]: 2896 Optional start date for data. If not specified, will default to the 2897 start date of the portfolio. 2898 end_date: Optional[datetime | string]: 2899 Optional end date for data. If not specified, will default to the 2900 end date of the portfolio. 2901 proxy: Optional[str] 2902 Your organization may require the use of a proxy for access. 2903 The address of a HTTPS proxy in the format of <address>:<port>. 2904 Examples are "123.456.789:123" or "my.proxy.com:123". 2905 Do not prepend with "https://". 2906 disable_verify_ssl: bool = False 2907 Your networking setup may be behind a firewall which performs SSL 2908 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2909 to point to the location of a custom certificate bundle, or set this 2910 parameter to true to disable SSL verification as a workaround. 2911 Returns 2912 ------- 2913 Nested dictionary: 2914 { 2915 "ticker1": { 2916 "hit_rate_mean": pd.DataFrame, 2917 "hit_rate_median": pd.DataFrame, 2918 "excess_return_mean": pd.DataFrame, 2919 "excess_return_median": pd.DataFrame, 2920 "return": "Recalculate the portfolio to get raw returns", 2921 "excess_return": pd.DataFrame, 2922 }, 2923 "ticker2": { 2924 "hit_rate_mean": pd.DataFrame, 2925 "hit_rate_median": pd.DataFrame, 2926 "excess_return_mean": pd.DataFrame, 2927 "excess_return_median": pd.DataFrame, 2928 "return": pd.DataFrame, 2929 "excess_return": pd.DataFrame, 2930 }, 2931 ... 2932 } 2933 Each dataframe above has columns: 2934 1D, 5D, 1M, 3M, 6M, 1Y, 2Y 2935 And row indexes: 2936 Q1, Q2, Q3, Q4, Q5 2937 2938 Note that the value for 'return' may be a string instead of a dataframe in 2939 cases where the data is not currently available in the specified portfolio. 2940 """ 2941 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2942 return client.getEquityAccuracy(model_id, portfolio_id, tickers, start_date, end_date)
Retrieves accuracy data for a given portfolio and list of tickers.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. tickers: List[str] List of tickers to get accuracy information with. start_date: Optional[datetime | string]: Optional start date for data. If not specified, will default to the start date of the portfolio. end_date: Optional[datetime | string]: Optional end date for data. If not specified, will default to the end date of the portfolio. proxy: Optional[str] Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Nested dictionary: { "ticker1": { "hit_rate_mean": pd.DataFrame, "hit_rate_median": pd.DataFrame, "excess_return_mean": pd.DataFrame, "excess_return_median": pd.DataFrame, "return": "Recalculate the portfolio to get raw returns", "excess_return": pd.DataFrame, }, "ticker2": { "hit_rate_mean": pd.DataFrame, "hit_rate_median": pd.DataFrame, "excess_return_mean": pd.DataFrame, "excess_return_median": pd.DataFrame, "return": pd.DataFrame, "excess_return": pd.DataFrame, }, ... } Each dataframe above has columns: 1D, 5D, 1M, 3M, 6M, 1Y, 2Y And row indexes: Q1, Q2, Q3, Q4, Q5
Note that the value for 'return' may be a string instead of a dataframe in cases where the data is not currently available in the specified portfolio.
2945def getHedgeExperiments( 2946 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2947) -> List[HedgeExperiment]: 2948 """ 2949 Get a list of all hedge experiments. 2950 Parameters 2951 ---------- 2952 apikey: str 2953 API key provided by Boosted. This key should be protected as a secret. 2954 proxy: str 2955 Your organization may require the use of a proxy for access. 2956 The address of a HTTPS proxy in the format of <address>:<port>. 2957 Examples are "123.456.789:123" or "my.proxy.com:123". 2958 Do not prepend with "https://". 2959 disable_verify_ssl: bool 2960 Your networking setup may be behind a firewall which performs SSL 2961 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2962 to point to the location of a custom certificate bundle, or set this 2963 parameter to true to disable SSL verification as a workaround. 2964 Returns 2965 ------- 2966 HedgeExperiment object 2967 Results of the hedge experiment. 2968 """ 2969 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2970 return client.get_hedge_experiments()
Get a list of all hedge experiments.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment object Results of the hedge experiment.
2973def getHedgeExperimentDetails( 2974 apikey: str, 2975 experiment_id: str, 2976 proxy: Optional[str] = None, 2977 disable_verify_ssl: bool = False, 2978) -> HedgeExperimentDetails: 2979 """ 2980 Get the details of a specific hedge experiment, as a HedgeExperiement object 2981 Parameters 2982 ---------- 2983 apikey: str 2984 API key provided by Boosted. This key should be protected as a secret. 2985 experiment_id: str 2986 UUID corresponding to the hedge experiment in question. 2987 proxy: str 2988 Your organization may require the use of a proxy for access. 2989 The address of a HTTPS proxy in the format of <address>:<port>. 2990 Examples are "123.456.789:123" or "my.proxy.com:123". 2991 Do not prepend with "https://". 2992 disable_verify_ssl: bool 2993 Your networking setup may be behind a firewall which performs SSL 2994 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2995 to point to the location of a custom certificate bundle, or set this 2996 parameter to true to disable SSL verification as a workaround. 2997 Returns 2998 ------- 2999 HedgeExperiment object 3000 Results of the hedge experiment. 3001 """ 3002 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3003 return client.get_hedge_experiment_details(experiment_id)
Get the details of a specific hedge experiment, as a HedgeExperiement object
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_id: str UUID corresponding to the hedge experiment in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment object Results of the hedge experiment.
3006def getPortfolioPerformance( 3007 apikey: str, 3008 portfolio_id: str, 3009 start_date: Optional[datetime.date] = None, 3010 end_date: Optional[datetime.date] = None, 3011 daily_returns: bool = False, 3012 proxy: Optional[str] = None, 3013 disable_verify_ssl: bool = False, 3014) -> pd.DataFrame: 3015 """ 3016 Get performance data for a portfolio. 3017 3018 Parameters 3019 ---------- 3020 apikey: str 3021 API key provided by Boosted. This key should be protected as a secret. 3022 portfolio_id: str 3023 UUID corresponding to the portfolio in question. 3024 proxy: str 3025 Your organization may require the use of a proxy for access. 3026 The address of a HTTPS proxy in the format of <address>:<port>. 3027 Examples are "123.456.789:123" or "my.proxy.com:123". 3028 Do not prepend with "https://". 3029 disable_verify_ssl: bool 3030 Your networking setup may be behind a firewall which performs SSL 3031 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3032 to point to the location of a custom certificate bundle, or set this 3033 parameter to true to disable SSL verification as a workaround. 3034 start_date: datetime.date 3035 Starting cutoff date to filter performance data 3036 end_date: datetime.date 3037 Ending cutoff date to filter performance data 3038 daily_returns: bool 3039 Flag indicating whether to add a new column with the daily return pct calculated 3040 3041 Returns 3042 ------- 3043 pd.DataFrame object 3044 Portfolio and benchmark performance. 3045 -index: 3046 "date": pd.DatetimeIndex 3047 -columns: 3048 "benchmark": benchmark performance, % return 3049 "turnover": portfolio turnover, % of equity 3050 "portfolio": return since beginning of portfolio, % return 3051 "daily_returns": daily percent change in value of the portfolio, % return 3052 (this column is optional and depends on the daily_returns flag) 3053 """ 3054 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3055 return client.get_portfolio_performance(portfolio_id, start_date, end_date, daily_returns)
Get performance data for a portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object Portfolio and benchmark performance. -index: "date": pd.DatetimeIndex -columns: "benchmark": benchmark performance, % return "turnover": portfolio turnover, % of equity "portfolio": return since beginning of portfolio, % return "daily_returns": daily percent change in value of the portfolio, % return (this column is optional and depends on the daily_returns flag)
3058def getPortfolioFactors( 3059 apikey: str, 3060 model_id: str, 3061 portfolio_id: str, 3062 proxy: Optional[str] = None, 3063 disable_verify_ssl: bool = False, 3064) -> pd.DataFrame: 3065 """ 3066 Get factor data concerning a hedge experiment portfolio 3067 3068 Parameters 3069 ---------- 3070 apikey: str 3071 API key provided by Boosted. This key should be protected as a secret. 3072 model_id: str 3073 UUID corresponding to the model in question. 3074 portfolio_id: str 3075 UUID corresponding to the portfolio in question. 3076 proxy: str 3077 Your organization may require the use of a proxy for access. 3078 The address of a HTTPS proxy in the format of <address>:<port>. 3079 Examples are "123.456.789:123" or "my.proxy.com:123". 3080 Do not prepend with "https://". 3081 disable_verify_ssl: bool 3082 Your networking setup may be behind a firewall which performs SSL 3083 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3084 to point to the location of a custom certificate bundle, or set this 3085 parameter to true to disable SSL verification as a workaround. 3086 3087 Returns 3088 ------- 3089 pd.DataFrame object 3090 - index: 3091 "date": pd.DatetimeIndex 3092 - columns: 3093 The following are factor weights corresponding to the named column. 3094 "size", 3095 "momentum", 3096 "dividend_yield", 3097 "volatility", 3098 "trading_activity", 3099 "value", 3100 "earnings_variability", 3101 "profitability", 3102 "growth", 3103 "leverage", 3104 "income_statement", 3105 "balance_sheet", 3106 "cash_flow", 3107 "environment", 3108 "social", 3109 "governance", 3110 "machine_1", 3111 "machine_2", 3112 "machine_3", 3113 "machine_4", 3114 "machine_5", 3115 "machine_6", 3116 "machine_7", 3117 "machine_8", 3118 "machine_9", 3119 "machine_10" 3120 """ 3121 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3122 return client.get_portfolio_factors(model_id, portfolio_id)
Get factor data concerning a hedge experiment portfolio
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID corresponding to the model in question. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object - index: "date": pd.DatetimeIndex - columns: The following are factor weights corresponding to the named column. "size", "momentum", "dividend_yield", "volatility", "trading_activity", "value", "earnings_variability", "profitability", "growth", "leverage", "income_statement", "balance_sheet", "cash_flow", "environment", "social", "governance", "machine_1", "machine_2", "machine_3", "machine_4", "machine_5", "machine_6", "machine_7", "machine_8", "machine_9", "machine_10"
3125def getPortfolioVolatility( 3126 apikey: str, 3127 model_id: str, 3128 portfolio_id: str, 3129 proxy: Optional[str] = None, 3130 disable_verify_ssl: bool = False, 3131) -> pd.DataFrame: 3132 """ 3133 Get volatility data concerning a hedge experiment portfolio 3134 3135 Parameters 3136 ---------- 3137 apikey: str 3138 API key provided by Boosted. This key should be protected as a secret. 3139 model_id: str 3140 UUID corresponding to the model in question. 3141 portfolio_id: str 3142 UUID corresponding to the portfolio in question. 3143 proxy: str 3144 Your organization may require the use of a proxy for access. 3145 The address of a HTTPS proxy in the format of <address>:<port>. 3146 Examples are "123.456.789:123" or "my.proxy.com:123". 3147 Do not prepend with "https://". 3148 disable_verify_ssl: bool 3149 Your networking setup may be behind a firewall which performs SSL 3150 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3151 to point to the location of a custom certificate bundle, or set this 3152 parameter to true to disable SSL verification as a workaround. 3153 3154 Returns 3155 ------- 3156 pd.DataFrame object 3157 - index: 3158 "date": pd.DatetimeIndex 3159 - columns: 3160 "avg_5d", 3161 "avg_10d", 3162 "avg_21d", 3163 "avg_63d", 3164 "avg_126d", 3165 "avg_189d", 3166 "avg_252d", 3167 "avg_315d", 3168 "avg_378d", 3169 "avg_441d", 3170 "avg_504d" 3171 """ 3172 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3173 return client.get_portfolio_volatility(model_id, portfolio_id)
Get volatility data concerning a hedge experiment portfolio
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID corresponding to the model in question. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object - index: "date": pd.DatetimeIndex - columns: "avg_5d", "avg_10d", "avg_21d", "avg_63d", "avg_126d", "avg_189d", "avg_252d", "avg_315d", "avg_378d", "avg_441d", "avg_504d"
3176def getPortfolioHoldings( 3177 apikey: str, 3178 model_id: str, 3179 portfolio_id: str, 3180 proxy: Optional[str] = None, 3181 disable_verify_ssl: bool = False, 3182) -> pd.DataFrame: 3183 """ 3184 Get holdings concerning a hedge experiment portfolio 3185 3186 Parameters 3187 ---------- 3188 apikey: str 3189 API key provided by Boosted. This key should be protected as a secret. 3190 model_id: str 3191 UUID corresponding to the model in question. 3192 portfolio_id: str 3193 UUID corresponding to the portfolio in question. 3194 proxy: str 3195 Your organization may require the use of a proxy for access. 3196 The address of a HTTPS proxy in the format of <address>:<port>. 3197 Examples are "123.456.789:123" or "my.proxy.com:123". 3198 Do not prepend with "https://". 3199 disable_verify_ssl: bool 3200 Your networking setup may be behind a firewall which performs SSL 3201 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3202 to point to the location of a custom certificate bundle, or set this 3203 parameter to true to disable SSL verification as a workaround. 3204 3205 Returns 3206 ------- 3207 pd.DataFrame object 3208 - index: 3209 "date": pd.DatetimeIndex 3210 - columns: 3211 "ticker", 3212 "isin", 3213 "region", 3214 "currency", 3215 "allocation" 3216 """ 3217 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3218 return client.get_portfolio_holdings(model_id, portfolio_id)
Get holdings concerning a hedge experiment portfolio
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID corresponding to the model in question. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object - index: "date": pd.DatetimeIndex - columns: "ticker", "isin", "region", "currency", "allocation"
3221def getStockDataTableForDate( 3222 apikey: str, 3223 model_id: str, 3224 portfolio_id: str, 3225 date: BoostedDate = datetime.date.today(), 3226 proxy: Optional[str] = None, 3227 disable_verify_ssl: bool = False, 3228) -> pd.DataFrame: 3229 """ 3230 Returns stock pricing and factors data for a given date. 3231 3232 Parameters 3233 ---------- 3234 apikey: str 3235 API key provided by Boosted. This key should be protected as a secret. 3236 model_id: str 3237 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 3238 button next to your model's name in the Model Summary Page in Boosted 3239 Insights. 3240 portfolio_id: str 3241 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 3242 date: datetime.date | str 3243 Date for which to fetch stock data table. Defaults to today. 3244 proxy: str 3245 Your organization may require the use of a proxy for access. 3246 The address of a HTTPS proxy in the format of <address>:<port>. 3247 Examples are "123.456.789:123" or "my.proxy.com:123". 3248 Do not prepend with "https://". 3249 disable_verify_ssl: bool 3250 Your networking setup may be behind a firewall which performs SSL 3251 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3252 to point to the location of a custom certificate bundle, or set this 3253 parameter to true to disable SSL verification as a workaround. 3254 3255 Returns 3256 ------- 3257 Stock data table as a dataframe indexed by ticker. 3258 """ 3259 date = convert_date(date) 3260 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3261 return client.getStockDataTableForDate(model_id, portfolio_id, date)
Returns stock pricing and factors data for a given date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch stock data table. Defaults to today. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Stock data table as a dataframe indexed by ticker.
3264def addHedgeExperimentScenario( 3265 apikey: str, 3266 experiment_id: str, 3267 scenario_name: str, 3268 scenario_settings: PortfolioSettings, 3269 run_scenario_immediately: bool = True, 3270 proxy: Optional[str] = None, 3271 disable_verify_ssl: bool = False, 3272) -> HedgeExperimentScenario: 3273 """ 3274 Create a hedge experiment scenario the Boosted platform. 3275 3276 Parameters 3277 ---------- 3278 apikey: str 3279 API key provided by Boosted. This key should be protected as a secret. 3280 experiment: HedgeExperiment 3281 An instance of the HedgeExperiment class that specifies 3282 your experiment configuration and metadata. 3283 run_scenario_immediately: Optional[bool] (default True) 3284 Flag that indicates whether to run the scenario upon submission or wait 3285 for a independent call to start the scenario at a later time. 3286 proxy: str 3287 Your organization may require the use of a proxy for access. 3288 The address of a HTTPS proxy in the format of <address>:<port>. 3289 Examples are "123.456.789:123" or "my.proxy.com:123". 3290 Do not prepend with "https://". 3291 disable_verify_ssl: bool 3292 Your networking setup may be behind a firewall which performs SSL 3293 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3294 to point to the location of a custom certificate bundle, or set this 3295 parameter to true to disable SSL verification as a workaround. 3296 3297 Returns 3298 ------- 3299 HedgeExperimentScenario 3300 - A scenario instance with associated metadata 3301 """ 3302 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3303 return client.add_hedge_experiment_scenario( 3304 experiment_id, scenario_name, scenario_settings, run_scenario_immediately 3305 )
Create a hedge experiment scenario the Boosted platform.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment: HedgeExperiment An instance of the HedgeExperiment class that specifies your experiment configuration and metadata. run_scenario_immediately: Optional[bool] (default True) Flag that indicates whether to run the scenario upon submission or wait for a independent call to start the scenario at a later time. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperimentScenario - A scenario instance with associated metadata
3308def createHedgeExperiment( 3309 apikey: str, 3310 experiment_name: str, 3311 experiment_description: str, 3312 experiment_type: hedge_experiment_type, 3313 target_securities: Union[Dict[GbiIdSecurity, float], str], 3314 proxy: Optional[str] = None, 3315 disable_verify_ssl: bool = False, 3316) -> HedgeExperiment: 3317 """ 3318 Creates a hedge experiment on the Boosted platform, returning an object 3319 representation of it. Note that currently this does NOT start the experiment; 3320 as created, the experiment is in an incomplete, draft state 3321 3322 Parameters 3323 ---------- 3324 apikey: str 3325 API key provided by Boosted. This key should be protected as a secret. 3326 experiment_name: str 3327 Name of the experiment 3328 experiment_description: str 3329 Your description of the experiment. 3330 experiment_type: str 3331 "HEDGE" - hedge out the risk of target securities 3332 "MIMIC" - mimic the target securities 3333 target_securities: Dict[GbiIdSecurity, float] | str 3334 Specification of securities to hedge or mimic as a weighted basket. This parameter 3335 can take the form of: 3336 {GbiIdSecurity: weight} - to manually specify securities and weights, OR 3337 portfolio_id - to use the most recent holdings/allocations of the passed 3338 portfolio as the securities and weights 3339 proxy: str 3340 Your organization may require the use of a proxy for access. 3341 The address of a HTTPS proxy in the format of <address>:<port>. 3342 Examples are "123.456.789:123" or "my.proxy.com:123". 3343 Do not prepend with "https://". 3344 disable_verify_ssl: bool 3345 Your networking setup may be behind a firewall which performs SSL 3346 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3347 to point to the location of a custom certificate bundle, or set this 3348 parameter to true to disable SSL verification as a workaround. 3349 Returns 3350 ------- 3351 HedgeExperiment 3352 """ 3353 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3354 return client.create_hedge_experiment( 3355 experiment_name, 3356 experiment_description, 3357 experiment_type, 3358 target_securities=target_securities, 3359 )
Creates a hedge experiment on the Boosted platform, returning an object representation of it. Note that currently this does NOT start the experiment; as created, the experiment is in an incomplete, draft state
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment experiment_description: str Your description of the experiment. experiment_type: str "HEDGE" - hedge out the risk of target securities "MIMIC" - mimic the target securities target_securities: Dict[GbiIdSecurity, float] | str Specification of securities to hedge or mimic as a weighted basket. This parameter can take the form of: {GbiIdSecurity: weight} - to manually specify securities and weights, OR portfolio_id - to use the most recent holdings/allocations of the passed portfolio as the securities and weights proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment
3362def modifyHedgeExperiment( 3363 apikey: str, 3364 experiment_id: str, 3365 experiment_name: Optional[str] = None, 3366 experiment_description: Optional[str] = None, 3367 experiment_type: Optional[hedge_experiment_type] = None, 3368 target_securities: Union[Dict[GbiIdSecurity, float], str, None] = None, 3369 model_ids: Optional[List[str]] = None, 3370 stock_universe_ids: Optional[List[str]] = None, 3371 create_default_scenario: bool = True, 3372 baseline_model_id: Optional[str] = None, 3373 baseline_stock_universe_id: Optional[str] = None, 3374 baseline_portfolio_settings: Optional[str] = None, 3375 proxy: Optional[str] = None, 3376 disable_verify_ssl: bool = False, 3377) -> HedgeExperiment: 3378 """ 3379 Modifies an existing hedge experiment on the Boosted platform, returning an object 3380 representation of it. Note that currently this does NOT start the experiment; 3381 a modified experiment is still in a draft state. 3382 3383 Parameters 3384 ---------- 3385 apikey: str 3386 API key provided by Boosted. This key should be protected as a secret. 3387 experiment_name: str 3388 Name of the experiment 3389 experiment_description: str 3390 Your description of the experiment. 3391 experiment_type: str 3392 "HEDGE" - hedge out the risk of target securities 3393 "MIMIC" - mimic the target securities 3394 target_securities: Dict[GbiIdSecurity, float] | str | None (default) 3395 Specification of securities to hedge or mimic as a weighted basket. This parameter 3396 can take the form of: 3397 {GbiIdSecurity: weight} - to manually specify securities and weights, OR 3398 portfolio_id - to use the most recent holdings/allocations of the passed 3399 portfolio as the securities and weights 3400 model_ids: List[str] 3401 A list of model ids that will be used for constructing scenario portfolios 3402 stock_universe_ids: List[str] 3403 A list of stock universe ids that will be used for constructing scenario portfolios 3404 create_default_scenario: bool 3405 Whether to create a "default/inferred" scenario 3406 baseline_model_id: str 3407 Model id to (optionally) use for the baseline portfolio 3408 baseline_stock_universe_id: str 3409 Universe id to use for the baseline portfolio 3410 baseline_portfolio_settings: str 3411 A valid json-string specifying settings for the baseline portfolio 3412 proxy: str 3413 Your organization may require the use of a proxy for access. 3414 The address of a HTTPS proxy in the format of <address>:<port>. 3415 Examples are "123.456.789:123" or "my.proxy.com:123". 3416 Do not prepend with "https://". 3417 disable_verify_ssl: bool 3418 Your networking setup may be behind a firewall which performs SSL 3419 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3420 to point to the location of a custom certificate bundle, or set this 3421 parameter to true to disable SSL verification as a workaround. 3422 3423 Returns 3424 ------- 3425 HedgeExperiment 3426 """ 3427 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3428 return client.modify_hedge_experiment( 3429 experiment_id, 3430 name=experiment_name, 3431 description=experiment_description, 3432 experiment_type=experiment_type, 3433 target_securities=target_securities, 3434 model_ids=model_ids, 3435 stock_universe_ids=stock_universe_ids, 3436 create_default_scenario=create_default_scenario, 3437 baseline_model_id=baseline_model_id, 3438 baseline_stock_universe_id=baseline_stock_universe_id, 3439 baseline_portfolio_settings=baseline_portfolio_settings, 3440 )
Modifies an existing hedge experiment on the Boosted platform, returning an object representation of it. Note that currently this does NOT start the experiment; a modified experiment is still in a draft state.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment experiment_description: str Your description of the experiment. experiment_type: str "HEDGE" - hedge out the risk of target securities "MIMIC" - mimic the target securities target_securities: Dict[GbiIdSecurity, float] | str | None (default) Specification of securities to hedge or mimic as a weighted basket. This parameter can take the form of: {GbiIdSecurity: weight} - to manually specify securities and weights, OR portfolio_id - to use the most recent holdings/allocations of the passed portfolio as the securities and weights model_ids: List[str] A list of model ids that will be used for constructing scenario portfolios stock_universe_ids: List[str] A list of stock universe ids that will be used for constructing scenario portfolios create_default_scenario: bool Whether to create a "default/inferred" scenario baseline_model_id: str Model id to (optionally) use for the baseline portfolio baseline_stock_universe_id: str Universe id to use for the baseline portfolio baseline_portfolio_settings: str A valid json-string specifying settings for the baseline portfolio proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment
3443def startHedgeExperiment( 3444 apikey: str, 3445 experiment_id: str, 3446 *scenario_ids: str, 3447 proxy: Optional[str] = None, 3448 disable_verify_ssl: bool = False, 3449) -> HedgeExperiment: 3450 """ 3451 Starts an existing hedge experiment on the Boosted platform, returning an object 3452 representation of it. This function also starts the indicated scenarios. 3453 3454 Parameters 3455 ---------- 3456 apikey: str 3457 API key provided by Boosted. This key should be protected as a secret. 3458 experiment_name: str 3459 Name of the experiment 3460 scenario_ids: str 3461 Var-args corresponding to scenario ids that you would like to start. 3462 proxy: str 3463 Your organization may require the use of a proxy for access. 3464 The address of a HTTPS proxy in the format of <address>:<port>. 3465 Examples are "123.456.789:123" or "my.proxy.com:123". 3466 Do not prepend with "https://". 3467 disable_verify_ssl: bool 3468 Your networking setup may be behind a firewall which performs SSL 3469 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3470 to point to the location of a custom certificate bundle, or set this 3471 parameter to true to disable SSL verification as a workaround. 3472 3473 Returns 3474 ------- 3475 HedgeExperiment 3476 """ 3477 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3478 return client.start_hedge_experiment(experiment_id, *scenario_ids)
Starts an existing hedge experiment on the Boosted platform, returning an object representation of it. This function also starts the indicated scenarios.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment scenario_ids: str Var-args corresponding to scenario ids that you would like to start. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment
3481def deleteHedgeExperiment( 3482 apikey: str, experiment_id: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 3483) -> bool: 3484 """ 3485 Deletes a hedge experiment and all associated scenarios. This is a permanent, 3486 irreversible action! 3487 3488 Parameters 3489 ---------- 3490 apikey: str 3491 API key provided by Boosted. This key should be protected as a secret. 3492 experiment_name: str 3493 Name of the experiment 3494 proxy: str 3495 Your organization may require the use of a proxy for access. 3496 The address of a HTTPS proxy in the format of <address>:<port>. 3497 Examples are "123.456.789:123" or "my.proxy.com:123". 3498 Do not prepend with "https://". 3499 disable_verify_ssl: bool 3500 Your networking setup may be behind a firewall which performs SSL 3501 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3502 to point to the location of a custom certificate bundle, or set this 3503 parameter to true to disable SSL verification as a workaround. 3504 3505 Returns 3506 ------- 3507 None 3508 """ 3509 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3510 return client.delete_hedge_experiment(experiment_id)
Deletes a hedge experiment and all associated scenarios. This is a permanent, irreversible action!
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
3513def createHedgeBasketPositionBoundsFromCsv( 3514 apikey: str, 3515 filepath: str, 3516 name: str, 3517 description: Optional[str] = None, 3518 mapping_result_filepath: Optional[str] = None, 3519 proxy: Optional[str] = None, 3520 disable_verify_ssl: bool = False, 3521) -> str: 3522 """ 3523 Creates a hedge basket security-level position bounds template setting from 3524 an input CSV of ISINs and weight constraints. 3525 3526 Parameters 3527 ---------- 3528 apikey: str 3529 API key provided by Boosted. This key should be protected as a secret. 3530 filepath: str 3531 Path to csv file from which to create the position bounds template. 3532 Required Columns: 3533 ISIN: str 3534 Lower Bound: float, 0-1 3535 Upper Bound: float, 0-1 3536 Optional Columns for use in security mapping: 3537 Date: str, ISO format 3538 Country: str, ISO format 3539 Currency: str, ISO format 3540 name: str 3541 name for the position bounds template 3542 description: str 3543 optional description for the position bounds template 3544 mapping_result_filepath: str 3545 if provided, writes the result of the mapping to this file location 3546 proxy: str 3547 Your organization may require the use of a proxy for access. 3548 The address of a HTTPS proxy in the format of <address>:<port>. 3549 Examples are "123.456.789:123" or "my.proxy.com:123". 3550 Do not prepend with "https://". 3551 disable_verify_ssl: bool 3552 Your networking setup may be behind a firewall which performs SSL 3553 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3554 to point to the location of a custom certificate bundle, or set this 3555 parameter to true to disable SSL verification as a workaround. 3556 3557 Returns 3558 ------- 3559 template_id: str 3560 UUID to identify the newly created position bounds template in the UI. 3561 """ 3562 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3563 return client.create_hedge_basket_position_bounds_from_csv( 3564 filepath, name, description, mapping_result_filepath 3565 )
Creates a hedge basket security-level position bounds template setting from an input CSV of ISINs and weight constraints.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. filepath: str Path to csv file from which to create the position bounds template. Required Columns: ISIN: str Lower Bound: float, 0-1 Upper Bound: float, 0-1 Optional Columns for use in security mapping: Date: str, ISO format Country: str, ISO format Currency: str, ISO format name: str name for the position bounds template description: str optional description for the position bounds template mapping_result_filepath: str if provided, writes the result of the mapping to this file location proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
template_id: str UUID to identify the newly created position bounds template in the UI.
3568def getHitRateFile( 3569 apikey: str, 3570 model_id: str, 3571 portfolio_id: str, 3572 file_key: str, 3573 proxy: Optional[str] = None, 3574 disable_verify_ssl: bool = False, 3575) -> dict: 3576 """ 3577 Returns the hit rate file given a model ID, portfolio ID, and file name, if it exists. 3578 Args: 3579 apikey: str 3580 API key provided by Boosted. This key should be protected as a secret. 3581 model_id: str 3582 Model ID associated with the file 3583 portfolio_id: str 3584 Portfolio ID associated with the file 3585 file_key: str 3586 The file name (will most often be a UUID) 3587 proxy: str 3588 Your organization may require the use of a proxy for access. 3589 The address of a HTTPS proxy in the format of <address>:<port>. 3590 Examples are "123.456.789:123" or "my.proxy.com:123". 3591 Do not prepend with "https://". 3592 disable_verify_ssl: bool 3593 Your networking setup may be behind a firewall which performs SSL 3594 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3595 to point to the location of a custom certificate bundle, or set this 3596 parameter to true to disable SSL verification as a workaround. 3597 3598 Returns: 3599 dict: Hit Rate data 3600 """ 3601 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3602 return client.get_hit_rate_file(model_id=model_id, portfolio_id=portfolio_id, file_key=file_key)
Returns the hit rate file given a model ID, portfolio ID, and file name, if it exists. Args: apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID associated with the file portfolio_id: str Portfolio ID associated with the file file_key: str The file name (will most often be a UUID) proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns: dict: Hit Rate data
3605def getHitRateWithSecurities( 3606 apikey: str, 3607 model_id: str, 3608 portfolio_id: str, 3609 meet_all_conditions: bool = False, 3610 securities: List[str] = [], 3611 countries: List[str] = [], 3612 sectors: List[str] = [], 3613 start_date: Optional[BoostedDate] = None, 3614 end_date: Optional[BoostedDate] = None, 3615 proxy: Optional[str] = None, 3616 disable_verify_ssl: bool = False, 3617) -> dict: 3618 """ 3619 Generate a hit rate file for a portfolio given securities/sectors/countries for filtering. 3620 Args: 3621 apikey: str 3622 API key provided by Boosted. This key should be protected as a secret. 3623 model_id: str 3624 Model ID 3625 portfolio_id: str 3626 Portfolio ID to use for the hit rate data 3627 meet_all_conditions: 3628 If True, must meet all non-empty filters 3629 securities: List[str] 3630 List of securities in ISIN format 3631 countries: List[str] 3632 List of countries in ISO3 format 3633 sectors: List[str] 3634 List of GICS sectors 3635 start_date: Optional[date] 3636 Start of date range for the hit rate data. Defaults to 5 weeks ago, 3637 or 5 weeks minus the start date. 3638 end_date: Optional[date] 3639 End of date range for the hit rate data. Defaults to today, or 3640 5 weeks plus the end_date. 3641 proxy: str 3642 Your organization may require the use of a proxy for access. 3643 The address of a HTTPS proxy in the format of <address>:<port>. 3644 Examples are "123.456.789:123" or "my.proxy.com:123". 3645 Do not prepend with "https://". 3646 disable_verify_ssl: bool 3647 Your networking setup may be behind a firewall which performs SSL 3648 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3649 to point to the location of a custom certificate bundle, or set this 3650 parameter to true to disable SSL verification as a workaround. 3651 3652 Returns: 3653 dict with three key-value pairs: 3654 "portfolio_id": portfolio ID 3655 "model_id" model ID 3656 "file_name" file key of the hit rate file. 3657 "gbi_ids" all ISINs that were included and used after filtering 3658 3659 Note that it will take up to 3 minutes for the hit rate file 3660 to generate after this API returns, before you can call getHitRateFile. 3661 """ 3662 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3663 return client.get_hit_rate_with_securities( 3664 model_id=model_id, 3665 portfolio_id=portfolio_id, 3666 meet_all_conditions=meet_all_conditions, 3667 securities=securities, 3668 countries=countries, 3669 sectors=sectors, 3670 start_date=start_date, 3671 end_date=end_date, 3672 )
Generate a hit rate file for a portfolio given securities/sectors/countries for filtering. Args: apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID portfolio_id: str Portfolio ID to use for the hit rate data meet_all_conditions: If True, must meet all non-empty filters securities: List[str] List of securities in ISIN format countries: List[str] List of countries in ISO3 format sectors: List[str] List of GICS sectors start_date: Optional[date] Start of date range for the hit rate data. Defaults to 5 weeks ago, or 5 weeks minus the start date. end_date: Optional[date] End of date range for the hit rate data. Defaults to today, or 5 weeks plus the end_date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns: dict with three key-value pairs: "portfolio_id": portfolio ID "model_id" model ID "file_name" file key of the hit rate file. "gbi_ids" all ISINs that were included and used after filtering
Note that it will take up to 3 minutes for the hit rate file
to generate after this API returns, before you can call getHitRateFile.
3675def getPortfolioAccuracy( 3676 apikey: str, 3677 model_id: str, 3678 portfolio_id: str, 3679 proxy: Optional[str] = None, 3680 disable_verify_ssl: bool = False, 3681 start_date: Optional[BoostedDate] = None, 3682 end_date: Optional[BoostedDate] = None, 3683) -> dict: 3684 """ 3685 Get the accuracy (hit rate & excess return) information of a given portfolio. 3686 Parameters 3687 ---------- 3688 apikey: str 3689 API key provided by Boosted. This key should be protected as a secret. 3690 model_id: str 3691 Model ID of the portfolio to fetch data for. 3692 portfolio_id: str 3693 ID of the portfolio to fetch data for. 3694 proxy: str 3695 Your organization may require the use of a proxy for access. 3696 The address of a HTTPS proxy in the format of <address>:<port>. 3697 Examples are "123.456.789:123" or "my.proxy.com:123". 3698 Do not prepend with "https://". 3699 disable_verify_ssl: bool 3700 Your networking setup may be behind a firewall which performs SSL 3701 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3702 to point to the location of a custom certificate bundle, or set this 3703 parameter to true to disable SSL verification as a workaround. 3704 start_date: Optional[datetime.date | str] 3705 Start date for portfolio accuracy date range. If this or end_date is 3706 omitted, full history will be returned. 3707 end_date: Optional[datetime.date | str] 3708 End date for portfolio accuracy date range. If this or start_date is 3709 omitted, full history will be returned. 3710 3711 Returns 3712 ------- 3713 accuracy: dict 3714 Dictionary containing accuracy information by Quantile, Decile and Ventile. 3715 """ 3716 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3717 return client.get_portfolio_accuracy( 3718 model_id, portfolio_id, start_date=start_date, end_date=end_date 3719 )
Get the accuracy (hit rate & excess return) information of a given portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID of the portfolio to fetch data for. portfolio_id: str ID of the portfolio to fetch data for. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
accuracy: dict Dictionary containing accuracy information by Quantile, Decile and Ventile.
3722def createWatchlist( 3723 apikey: str, 3724 name: str, 3725 proxy: Optional[str] = None, 3726 disable_verify_ssl: bool = False, 3727) -> str: 3728 """ 3729 Create a watchlist and get back the watchlist_id for it 3730 3731 Parameters 3732 ---------- 3733 apikey: str 3734 API key provided by Boosted. This key should be protected as a secret. 3735 name: str 3736 Name to associate with the watchlist 3737 proxy: str 3738 Your organization may require the use of a proxy for access. 3739 The address of a HTTPS proxy in the format of <address>:<port>. 3740 Examples are "123.456.789:123" or "my.proxy.com:123". 3741 Do not prepend with "https://". 3742 disable_verify_ssl: bool 3743 Your networking setup may be behind a firewall which performs SSL 3744 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3745 to point to the location of a custom certificate bundle, or set this 3746 parameter to true to disable SSL verification as a workaround. 3747 Returns 3748 ------- 3749 watchlist_id: str 3750 UUID to uniquely identify the newly created watchlist 3751 """ 3752 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3753 return client.create_watchlist(name)
Create a watchlist and get back the watchlist_id for it
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. name: str Name to associate with the watchlist proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
watchlist_id: str UUID to uniquely identify the newly created watchlist
3756def createWatchlistFromFile( 3757 apikey: str, 3758 name: str, 3759 filepath: str, 3760 proxy: Optional[str] = None, 3761 disable_verify_ssl: bool = False, 3762) -> str: 3763 """ 3764 Create a watchlist and get back the watchlist_id for it 3765 3766 Parameters 3767 ---------- 3768 apikey: str 3769 API key provided by Boosted. This key should be protected as a secret. 3770 name: str 3771 Name to associate with the watchlist 3772 filepath: str 3773 path to file to upload, 3774 proxy: str 3775 Your organization may require the use of a proxy for access. 3776 The address of a HTTPS proxy in the format of <address>:<port>. 3777 Examples are "123.456.789:123" or "my.proxy.com:123". 3778 Do not prepend with "https://". 3779 disable_verify_ssl: bool 3780 Your networking setup may be behind a firewall which performs SSL 3781 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3782 to point to the location of a custom certificate bundle, or set this 3783 parameter to true to disable SSL verification as a workaround. 3784 Returns 3785 ------- 3786 watchlist_id: str 3787 UUID to uniquely identify the newly created watchlist 3788 """ 3789 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3790 return client.create_watchlist_from_file(name, filepath)
Create a watchlist and get back the watchlist_id for it
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. name: str Name to associate with the watchlist filepath: str path to file to upload, proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
watchlist_id: str UUID to uniquely identify the newly created watchlist
3793def getWatchlists( 3794 apikey: str, 3795 proxy: Optional[str] = None, 3796 disable_verify_ssl: bool = False, 3797) -> List[Dict]: 3798 """ 3799 Get the list of watchlists 3800 3801 Parameters 3802 ---------- 3803 apikey: str 3804 API key provided by Boosted. This key should be protected as a secret. 3805 proxy: str 3806 Your organization may require the use of a proxy for access. 3807 The address of a HTTPS proxy in the format of <address>:<port>. 3808 Examples are "123.456.789:123" or "my.proxy.com:123". 3809 Do not prepend with "https://". 3810 disable_verify_ssl: bool 3811 Your networking setup may be behind a firewall which performs SSL 3812 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3813 to point to the location of a custom certificate bundle, or set this 3814 parameter to true to disable SSL verification as a workaround. 3815 Returns 3816 ------- 3817 watchlists: List[Dict] 3818 List of dictionaries with watchlist_id and name 3819 """ 3820 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3821 return client.get_watchlists()
Get the list of watchlists
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
watchlists: List[Dict] List of dictionaries with watchlist_id and name
3824def getWatchlistContents( 3825 apikey: str, 3826 watchlist_id: str, 3827 proxy: Optional[str] = None, 3828 disable_verify_ssl: bool = False, 3829) -> Dict: 3830 """ 3831 Add a list of ISINs to a watchlist 3832 Parameters 3833 ---------- 3834 apikey: str 3835 API key provided by Boosted. This key should be protected as a secret. 3836 watchlist_id: str 3837 The UUID for an existing watchlist that the user has read access to 3838 proxy: str 3839 Your organization may require the use of a proxy for access. 3840 The address of a HTTPS proxy in the format of <address>:<port>. 3841 Examples are "123.456.789:123" or "my.proxy.com:123". 3842 Do not prepend with "https://". 3843 disable_verify_ssl: bool 3844 Your networking setup may be behind a firewall which performs SSL 3845 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3846 to point to the location of a custom certificate bundle, or set this 3847 parameter to true to disable SSL verification as a workaround. 3848 Returns 3849 ------- 3850 Information suitable to recreate the watchlist 3851 Dict { 3852 "watchlist_id": str 3853 "contents": List[Dict] 3854 Keys: 'ISIN' 'TICKER', 'COUNTRY', 'CURRENCY', 'CATEGORY' 3855 } 3856 3857 """ 3858 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3859 return client.get_watchlist_contents(watchlist_id)
Add a list of ISINs to a watchlist
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Information suitable to recreate the watchlist
Dict { "watchlist_id": str "contents": List[Dict] Keys: 'ISIN' 'TICKER', 'COUNTRY', 'CURRENCY', 'CATEGORY' }
3862def getWatchlistContentsAsCsv( 3863 apikey: str, 3864 watchlist_id: str, 3865 filepath: str, 3866 proxy: Optional[str] = None, 3867 disable_verify_ssl: bool = False, 3868) -> None: 3869 """ 3870 Get Watchlist securities in csv format 3871 Parameters 3872 ---------- 3873 apikey: str 3874 API key provided by Boosted. This key should be protected as a secret. 3875 watchlist_id: str 3876 The UUID for an existing watchlist that the user has read access to 3877 filepath: str 3878 Destination for csv file to be written to 3879 proxy: str 3880 Your organization may require the use of a proxy for access. 3881 The address of a HTTPS proxy in the format of <address>:<port>. 3882 Examples are "123.456.789:123" or "my.proxy.com:123". 3883 Do not prepend with "https://". 3884 disable_verify_ssl: bool 3885 Your networking setup may be behind a firewall which performs SSL 3886 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3887 to point to the location of a custom certificate bundle, or set this 3888 parameter to true to disable SSL verification as a workaround. 3889 Returns 3890 ------- 3891 None 3892 """ 3893 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3894 return client.get_watchlist_contents_as_csv(watchlist_id, filepath)
Get Watchlist securities in csv format
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to filepath: str Destination for csv file to be written to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
3897def getCoverageInfo( 3898 apikey: str, 3899 watchlist_id: str, 3900 portfolio_group_id: str, 3901 proxy: Optional[str] = None, 3902 disable_verify_ssl: bool = False, 3903) -> pd.DataFrame: 3904 """ 3905 Get Coverage info for a given watchlist and portfolio group 3906 Parameters 3907 ---------- 3908 apikey: str 3909 API key provided by Boosted. This key should be protected as a secret. 3910 watchlist_id: str 3911 The UUID for an existing watchlist that the user has read access to 3912 portfolio_group_id: str 3913 The UUID for an existing portfolio group that the user has read access to 3914 proxy: str 3915 Your organization may require the use of a proxy for access. 3916 The address of a HTTPS proxy in the format of <address>:<port>. 3917 Examples are "123.456.789:123" or "my.proxy.com:123". 3918 Do not prepend with "https://". 3919 disable_verify_ssl: bool 3920 Your networking setup may be behind a firewall which performs SSL 3921 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3922 to point to the location of a custom certificate bundle, or set this 3923 parameter to true to disable SSL verification as a workaround. 3924 Returns 3925 ------- 3926 pd.DataFrame 3927 """ 3928 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3929 return client.get_coverage_info(watchlist_id, portfolio_group_id)
Get Coverage info for a given watchlist and portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to portfolio_group_id: str The UUID for an existing portfolio group that the user has read access to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame
3932def getCoverageCsv( 3933 apikey: str, 3934 watchlist_id: str, 3935 portfolio_group_id: str, 3936 filepath: Optional[str], 3937 proxy: Optional[str] = None, 3938 disable_verify_ssl: bool = False, 3939) -> Optional[str]: 3940 """ 3941 Get Coverage info for a given watchlist and portfolio group 3942 Parameters 3943 ---------- 3944 apikey: str 3945 API key provided by Boosted. This key should be protected as a secret. 3946 watchlist_id: str 3947 The UUID for an existing watchlist that the user has read access to 3948 portfolio_group_id: str 3949 The UUID for an existing portfolio group that the user has read access to 3950 filepath: Optional[str] = None 3951 The location to write csv file to 3952 proxy: str 3953 Your organization may require the use of a proxy for access. 3954 The address of a HTTPS proxy in the format of <address>:<port>. 3955 Examples are "123.456.789:123" or "my.proxy.com:123". 3956 Do not prepend with "https://". 3957 disable_verify_ssl: bool 3958 Your networking setup may be behind a firewall which performs SSL 3959 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3960 to point to the location of a custom certificate bundle, or set this 3961 parameter to true to disable SSL verification as a workaround. 3962 Returns 3963 ------- 3964 None if filepath is provided, else a string with a csv's contents is returned 3965 """ 3966 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3967 return client.get_coverage_csv(watchlist_id, portfolio_group_id, filepath)
Get Coverage info for a given watchlist and portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to portfolio_group_id: str The UUID for an existing portfolio group that the user has read access to filepath: Optional[str] = None The location to write csv file to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None if filepath is provided, else a string with a csv's contents is returned
3970def addSecuritiesToWatchlist( 3971 apikey: str, 3972 watchlist_id: str, 3973 identifiers: List[str], 3974 identifier_type: Literal["TICKER", "ISIN"], 3975 proxy: Optional[str] = None, 3976 disable_verify_ssl: bool = False, 3977) -> Dict: 3978 """ 3979 Add a list of ISINs to a watchlist 3980 Parameters 3981 ---------- 3982 apikey: str 3983 API key provided by Boosted. This key should be protected as a secret. 3984 watchlist_id: str 3985 The UUID for an existing watchlist that the user has write access to 3986 identifiers: List[str] 3987 The list of identifiers to be added to the watchlist. These identifiers can 3988 be tickers or ISINs. See identifier_type. 3989 identifier_type: Literal["TICKER", "ISIN"] 3990 Specifier for the type of identifier. 3991 proxy: str 3992 Your organization may require the use of a proxy for access. 3993 The address of a HTTPS proxy in the format of <address>:<port>. 3994 Examples are "123.456.789:123" or "my.proxy.com:123". 3995 Do not prepend with "https://". 3996 disable_verify_ssl: bool 3997 Your networking setup may be behind a firewall which performs SSL 3998 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3999 to point to the location of a custom certificate bundle, or set this 4000 parameter to true to disable SSL verification as a workaround. 4001 Returns 4002 ------- 4003 status: Dict #FIXME - im not sure what we want to return here 4004 Information about what was modified to in the watchlist 4005 """ 4006 if identifier_type not in ["TICKER", "ISIN"]: 4007 raise ValueError( 4008 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4009 ) 4010 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4011 return client.add_securities_to_watchlist(watchlist_id, identifiers, identifier_type)
Add a list of ISINs to a watchlist
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has write access to identifiers: List[str] The list of identifiers to be added to the watchlist. These identifiers can be tickers or ISINs. See identifier_type. identifier_type: Literal["TICKER", "ISIN"] Specifier for the type of identifier. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
status: Dict #FIXME - im not sure what we want to return here Information about what was modified to in the watchlist
4014def removeSecuritiesFromWatchlist( 4015 apikey: str, 4016 watchlist_id: str, 4017 identifiers: List[str], 4018 identifier_type: Literal["TICKER", "ISIN"], 4019 proxy: Optional[str] = None, 4020 disable_verify_ssl: bool = False, 4021) -> Dict: 4022 """ 4023 Add a list of ISINs to a watchlist 4024 Parameters 4025 ---------- 4026 apikey: str 4027 API key provided by Boosted. This key should be protected as a secret. 4028 watchlist_id: str 4029 The UUID for an existing watchlist that the user has write access to 4030 identifiers: List[str] 4031 The list of identifiers to be added to the watchlist. These identifiers can 4032 be tickers or ISINs. See identifier_type. 4033 identifier_type: Literal["TICKER", "ISIN"] 4034 Specifier for the type of identifier. 4035 proxy: str 4036 Your organization may require the use of a proxy for access. 4037 The address of a HTTPS proxy in the format of <address>:<port>. 4038 Examples are "123.456.789:123" or "my.proxy.com:123". 4039 Do not prepend with "https://". 4040 disable_verify_ssl: bool 4041 Your networking setup may be behind a firewall which performs SSL 4042 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4043 to point to the location of a custom certificate bundle, or set this 4044 parameter to true to disable SSL verification as a workaround. 4045 Returns 4046 ------- 4047 status: Dict #FIXME - im not sure what we want to return here 4048 Information about what was modified to in the watchlist 4049 """ 4050 if identifier_type not in ["TICKER", "ISIN"]: 4051 raise ValueError( 4052 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4053 ) 4054 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4055 return client.remove_securities_from_watchlist(watchlist_id, identifiers, identifier_type)
Add a list of ISINs to a watchlist
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has write access to identifiers: List[str] The list of identifiers to be added to the watchlist. These identifiers can be tickers or ISINs. See identifier_type. identifier_type: Literal["TICKER", "ISIN"] Specifier for the type of identifier. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
status: Dict #FIXME - im not sure what we want to return here Information about what was modified to in the watchlist
4058def setPortfolioGroupForWatchlist( 4059 apikey: str, 4060 portfolio_group_id: str, 4061 watchlist_id: str, 4062 proxy: Optional[str] = None, 4063 disable_verify_ssl: bool = False, 4064) -> Dict: 4065 """ 4066 Set portfolio group for watchlist. 4067 4068 Parameters 4069 ---------- 4070 apikey: str 4071 API key provided by Boosted. This key should be protected as a secret. 4072 portfolio_group_id: str, 4073 UUID str identifying a portfolio group 4074 watchlist_id: str, 4075 UUID str identifying a watchlist 4076 proxy: str 4077 Your organization may require the use of a proxy for access. 4078 The address of a HTTPS proxy in the format of <address>:<port>. 4079 Examples are "123.456.789:123" or "my.proxy.com:123". 4080 Do not prepend with "https://". 4081 disable_verify_ssl: bool 4082 Your networking setup may be behind a firewall which performs SSL 4083 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4084 to point to the location of a custom certificate bundle, or set this 4085 parameter to true to disable SSL verification as a workaround. 4086 Returns 4087 ------- 4088 Dict: with a list of all portfolio groups for the user 4089 """ 4090 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4091 return client.set_portfolio_group_for_watchlist(portfolio_group_id, watchlist_id)
Set portfolio group for watchlist.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_group_id: str, UUID str identifying a portfolio group watchlist_id: str, UUID str identifying a watchlist proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict: with a list of all portfolio groups for the user
4094def setStickyPortfolioGroup( 4095 apikey: str, 4096 portfolio_group_id: str, 4097 proxy: Optional[str] = None, 4098 disable_verify_ssl: bool = False, 4099) -> Dict: 4100 """ 4101 Set sticky portfolio group for the user. 4102 4103 Parameters 4104 ---------- 4105 apikey: str 4106 API key provided by Boosted. This key should be protected as a secret. 4107 portfolio_group_id: str, 4108 UUID str identifying a portfolio group 4109 proxy: str 4110 Your organization may require the use of a proxy for access. 4111 The address of a HTTPS proxy in the format of <address>:<port>. 4112 Examples are "123.456.789:123" or "my.proxy.com:123". 4113 Do not prepend with "https://". 4114 disable_verify_ssl: bool 4115 Your networking setup may be behind a firewall which performs SSL 4116 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4117 to point to the location of a custom certificate bundle, or set this 4118 parameter to true to disable SSL verification as a workaround. 4119 Returns 4120 ------- 4121 Dict: with a list of all portfolio groups for the user 4122 """ 4123 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4124 return client.set_sticky_portfolio_group(portfolio_group_id)
Set sticky portfolio group for the user.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_group_id: str, UUID str identifying a portfolio group proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict: with a list of all portfolio groups for the user
4127def getStickyPortfolioGroup( 4128 apikey: str, 4129 proxy: Optional[str] = None, 4130 disable_verify_ssl: bool = False, 4131) -> Dict: 4132 """ 4133 Get sticky portfolio group for the user. 4134 4135 Parameters 4136 ---------- 4137 apikey: str 4138 API key provided by Boosted. This key should be protected as a secret. 4139 proxy: str 4140 Your organization may require the use of a proxy for access. 4141 The address of a HTTPS proxy in the format of <address>:<port>. 4142 Examples are "123.456.789:123" or "my.proxy.com:123". 4143 Do not prepend with "https://". 4144 disable_verify_ssl: bool 4145 Your networking setup may be behind a firewall which performs SSL 4146 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4147 to point to the location of a custom certificate bundle, or set this 4148 parameter to true to disable SSL verification as a workaround. 4149 Returns 4150 ------- 4151 Dict { 4152 group_id: str 4153 group_name: str 4154 portfolios: List[PortfolioInGroup(Dict)] 4155 PortfolioInGroup(Dict): 4156 portfolio_id: str 4157 rank_in_group: Optional[int] = None 4158 portfolio_name: Optional[str] = None 4159 } 4160 """ 4161 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4162 return client.get_sticky_portfolio_group()
Get sticky portfolio group for the user.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict {
group_id: str
group_name: str
portfolios: List[PortfolioInGroup(Dict)]
PortfolioInGroup(Dict):
portfolio_id: str
rank_in_group: Optional[int] = None
portfolio_name: Optional[str] = None
}
4165def getPortfolioGroup( 4166 apikey: str, 4167 portfolio_group_id: str, 4168 proxy: Optional[str] = None, 4169 disable_verify_ssl: bool = False, 4170) -> Dict: 4171 """ 4172 Get a single portfolio group. 4173 4174 Parameters 4175 ---------- 4176 apikey: str 4177 API key provided by Boosted. This key should be protected as a secret. 4178 portfolio_group_id: str, 4179 UUID str identifying a portfolio group 4180 proxy: str 4181 Your organization may require the use of a proxy for access. 4182 The address of a HTTPS proxy in the format of <address>:<port>. 4183 Examples are "123.456.789:123" or "my.proxy.com:123". 4184 Do not prepend with "https://". 4185 disable_verify_ssl: bool 4186 Your networking setup may be behind a firewall which performs SSL 4187 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4188 to point to the location of a custom certificate bundle, or set this 4189 parameter to true to disable SSL verification as a workaround. 4190 Returns 4191 ------- 4192 PortfolioGroup: Dict: { 4193 group_id: str 4194 group_name: str 4195 portfolios: List[PortfolioInGroup] 4196 } 4197 where PortfolioInGroup is defined as = Dict { 4198 portfolio_id: str 4199 portfolio_name: str 4200 rank_in_group: Optional[int] 4201 } 4202 """ 4203 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4204 return client.get_portfolio_group(portfolio_group_id)
Get a single portfolio group.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_group_id: str, UUID str identifying a portfolio group proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
PortfolioGroup: Dict: { group_id: str group_name: str portfolios: List[PortfolioInGroup] } where PortfolioInGroup is defined as = Dict { portfolio_id: str portfolio_name: str rank_in_group: Optional[int] }
4207def getPortfolioGroups( 4208 apikey: str, 4209 proxy: Optional[str] = None, 4210 disable_verify_ssl: bool = False, 4211) -> Dict: 4212 """ 4213 Get a list of all portfolio groups for the user 4214 4215 Parameters 4216 ---------- 4217 apikey: str 4218 API key provided by Boosted. This key should be protected as a secret. 4219 proxy: str 4220 Your organization may require the use of a proxy for access. 4221 The address of a HTTPS proxy in the format of <address>:<port>. 4222 Examples are "123.456.789:123" or "my.proxy.com:123". 4223 Do not prepend with "https://". 4224 disable_verify_ssl: bool 4225 Your networking setup may be behind a firewall which performs SSL 4226 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4227 to point to the location of a custom certificate bundle, or set this 4228 parameter to true to disable SSL verification as a workaround. 4229 Returns 4230 ------- 4231 Dict: with a list of all portfolio groups for the user 4232 """ 4233 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4234 return client.get_portfolio_groups()
Get a list of all portfolio groups for the user
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict: with a list of all portfolio groups for the user
4237def createPortfolioGroup( 4238 apikey: str, 4239 group_name: str, 4240 portfolios: Optional[List[Dict]] = None, 4241 proxy: Optional[str] = None, 4242 disable_verify_ssl: bool = False, 4243) -> Dict: 4244 """ 4245 Create a new portfolio group 4246 4247 Parameters 4248 ---------- 4249 apikey: str 4250 API key provided by Boosted. This key should be protected as a secret. 4251 4252 group_name: str 4253 name of the new group 4254 4255 portfolios: List of Dict [: 4256 4257 portfolio_id: str 4258 rank_in_group: Optional[int] = None 4259 ] 4260 4261 proxy: str 4262 Your organization may require the use of a proxy for access. 4263 The address of a HTTPS proxy in the format of <address>:<port>. 4264 Examples are "123.456.789:123" or "my.proxy.com:123". 4265 Do not prepend with "https://". 4266 disable_verify_ssl: bool 4267 Your networking setup may be behind a firewall which performs SSL 4268 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4269 to point to the location of a custom certificate bundle, or set this 4270 parameter to true to disable SSL verification as a workaround. 4271 4272 4273 Returns: 4274 ---------- 4275 4276 Dict: { 4277 group_id: str 4278 UUID identifier for the portfolio group 4279 4280 created: int 4281 num groups created, 1 == success 4282 4283 added: int 4284 num portfolios added to the group, should match the length of 'portfolios' argument 4285 } 4286 4287 """ 4288 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4289 return client.create_portfolio_group(group_name, portfolios)
Create a new portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_name: str name of the new group
portfolios: List of Dict [:
portfolio_id: str
rank_in_group: Optional[int] = None
]
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict: {
group_id: str
UUID identifier for the portfolio group
created: int
num groups created, 1 == success
added: int
num portfolios added to the group, should match the length of 'portfolios' argument
}
4292def renamePortfolioGroup( 4293 apikey: str, 4294 group_id: str, 4295 group_name: str, 4296 proxy: Optional[str] = None, 4297 disable_verify_ssl: bool = False, 4298) -> Dict: 4299 """ 4300 Rename a portfolio group 4301 4302 Parameters 4303 ---------- 4304 apikey: str 4305 API key provided by Boosted. This key should be protected as a secret. 4306 4307 group_id: str, 4308 UUID str identifying a portfolio group 4309 4310 group_name: str, 4311 The new name for the porfolio 4312 4313 proxy: str 4314 Your organization may require the use of a proxy for access. 4315 The address of a HTTPS proxy in the format of <address>:<port>. 4316 Examples are "123.456.789:123" or "my.proxy.com:123". 4317 Do not prepend with "https://". 4318 disable_verify_ssl: bool 4319 Your networking setup may be behind a firewall which performs SSL 4320 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4321 to point to the location of a custom certificate bundle, or set this 4322 parameter to true to disable SSL verification as a workaround. 4323 4324 Returns: 4325 ------- 4326 Dict { 4327 changed: int - 1 == success 4328 } 4329 """ 4330 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4331 return client.rename_portfolio_group(group_id, group_name)
Rename a portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str, UUID str identifying a portfolio group
group_name: str, The new name for the porfolio
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict {
changed: int - 1 == success
}
4334def addToPortfolioGroup( 4335 apikey: str, 4336 group_id: str, 4337 portfolios: List[Dict], 4338 proxy: Optional[str] = None, 4339 disable_verify_ssl: bool = False, 4340) -> Dict: 4341 """ 4342 Add portfolios to a group 4343 4344 Parameters 4345 ---------- 4346 apikey: str 4347 API key provided by Boosted. This key should be protected as a secret. 4348 4349 group_id: str, 4350 UUID str identifying a portfolio group 4351 4352 portfolios: List of Dict [: 4353 portfolio_id: str 4354 rank_in_group: Optional[int] = None 4355 ] 4356 4357 4358 proxy: str 4359 Your organization may require the use of a proxy for access. 4360 The address of a HTTPS proxy in the format of <address>:<port>. 4361 Examples are "123.456.789:123" or "my.proxy.com:123". 4362 Do not prepend with "https://". 4363 disable_verify_ssl: bool 4364 Your networking setup may be behind a firewall which performs SSL 4365 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4366 to point to the location of a custom certificate bundle, or set this 4367 parameter to true to disable SSL verification as a workaround. 4368 4369 4370 Returns: 4371 ------- 4372 Dict { 4373 added: int 4374 number of successful changes 4375 } 4376 """ 4377 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4378 return client.add_to_portfolio_group(group_id, portfolios)
Add portfolios to a group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str,
UUID str identifying a portfolio group
portfolios: List of Dict [:
portfolio_id: str
rank_in_group: Optional[int] = None
]
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict { added: int number of successful changes }
4381def removeFromPortfolioGroup( 4382 apikey: str, 4383 group_id: str, 4384 portfolios: List[str], 4385 proxy: Optional[str] = None, 4386 disable_verify_ssl: bool = False, 4387) -> Dict: 4388 """ 4389 Remove portfolios from a group 4390 4391 Parameters 4392 ---------- 4393 apikey: str 4394 API key provided by Boosted. This key should be protected as a secret. 4395 4396 group_id: str, 4397 UUID str identifying a portfolio group 4398 4399 portfolios: List of str 4400 4401 4402 proxy: str 4403 Your organization may require the use of a proxy for access. 4404 The address of a HTTPS proxy in the format of <address>:<port>. 4405 Examples are "123.456.789:123" or "my.proxy.com:123". 4406 Do not prepend with "https://". 4407 disable_verify_ssl: bool 4408 Your networking setup may be behind a firewall which performs SSL 4409 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4410 to point to the location of a custom certificate bundle, or set this 4411 parameter to true to disable SSL verification as a workaround. 4412 4413 4414 Returns: 4415 ------- 4416 Dict { 4417 removed: int 4418 number of successful changes 4419 } 4420 """ 4421 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4422 return client.remove_from_portfolio_group(group_id, portfolios)
Remove portfolios from a group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str, UUID str identifying a portfolio group
portfolios: List of str
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict { removed: int number of successful changes }
4425def deletePortfolioGroup( 4426 apikey: str, 4427 group_id: str, 4428 proxy: Optional[str] = None, 4429 disable_verify_ssl: bool = False, 4430) -> Dict: 4431 """ 4432 Delete a portfolio group 4433 4434 Parameters 4435 ---------- 4436 4437 apikey: str 4438 API key provided by Boosted. This key should be protected as a secret. 4439 4440 group_id: str, 4441 UUID str identifying a portfolio group 4442 4443 proxy: str 4444 Your organization may require the use of a proxy for access. 4445 The address of a HTTPS proxy in the format of <address>:<port>. 4446 Examples are "123.456.789:123" or "my.proxy.com:123". 4447 Do not prepend with "https://". 4448 disable_verify_ssl: bool 4449 Your networking setup may be behind a firewall which performs SSL 4450 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4451 to point to the location of a custom certificate bundle, or set this 4452 parameter to true to disable SSL verification as a workaround. 4453 4454 Returns 4455 ------- 4456 4457 Dict { 4458 removed_groups: int 4459 number of successful changes 4460 4461 removed_portfolios: int 4462 number of successful changes 4463 } 4464 4465 """ 4466 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4467 return client.delete_portfolio_group(group_id)
Delete a portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str, UUID str identifying a portfolio group
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict {
removed_groups: int
number of successful changes
removed_portfolios: int
number of successful changes
}
4470def getRiskGroups( 4471 apikey: str, 4472 model_id: str, 4473 portfolio_id: str, 4474 date: BoostedDate = datetime.date.today(), 4475 proxy: Optional[str] = None, 4476 disable_verify_ssl: bool = False, 4477 use_v2: bool = False, 4478) -> List[Dict[str, Any]]: 4479 """ 4480 Given a model and portfolio, returns the calculated semantic risk groups. 4481 4482 Parameters 4483 ---------- 4484 apikey: str 4485 API key provided by Boosted. This key should be protected as a secret. 4486 model_id: str 4487 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4488 button next to your model's name in the Model Summary Page in Boosted 4489 Insights. 4490 portfolio_id: str 4491 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4492 date: datetime.date | str 4493 Date for which to fetch data. Defaults to "today". 4494 use_v2: bool 4495 Whether to use the "V2" version of risk factors data. 4496 proxy: str 4497 Your organization may require the use of a proxy for access. 4498 The address of a HTTPS proxy in the format of <address>:<port>. 4499 Examples are "123.456.789:123" or "my.proxy.com:123". 4500 Do not prepend with "https://". 4501 disable_verify_ssl: bool 4502 Your networking setup may be behind a firewall which performs SSL 4503 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4504 to point to the location of a custom certificate bundle, or set this 4505 parameter to true to disable SSL verification as a workaround. 4506 4507 Returns 4508 ------- 4509 A list of dictionaries. Each dictionary has the following keys: 4510 machine: int 4511 E.g. 1 for "machine_1", 2 for "machine_2", etc. 4512 risk_group_a: List[str] 4513 List of stock descriptors risk group a (e.g. Cruises, Airlines, etc.) 4514 risk_group_b: List[str] 4515 List of stock descriptors risk group b (e.g. Cruises, Airlines, etc.) 4516 volatility_explained: float 4517 Decimal between 0.0 and 1.0 that represents the percent of stock 4518 universe volatility explained by these groups. 4519 """ 4520 date = convert_date(date) 4521 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4522 return client.get_risk_groups(model_id, portfolio_id, date, use_v2)
Given a model and portfolio, returns the calculated semantic risk groups.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch data. Defaults to "today". use_v2: bool Whether to use the "V2" version of risk factors data. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of dictionaries. Each dictionary has the following keys: machine: int E.g. 1 for "machine_1", 2 for "machine_2", etc. risk_group_a: List[str] List of stock descriptors risk group a (e.g. Cruises, Airlines, etc.) risk_group_b: List[str] List of stock descriptors risk group b (e.g. Cruises, Airlines, etc.) volatility_explained: float Decimal between 0.0 and 1.0 that represents the percent of stock universe volatility explained by these groups.
4525def getRiskFactorsDiscoveredDescriptors( 4526 apikey: str, 4527 model_id: str, 4528 portfolio_id: str, 4529 date: BoostedDate = datetime.date.today(), 4530 proxy: Optional[str] = None, 4531 disable_verify_ssl: bool = False, 4532 use_v2: bool = False, 4533) -> pd.DataFrame: 4534 """ 4535 Given a model and portfolio, returns the calculated semantic risk discovered 4536 descriptors. 4537 4538 Parameters 4539 ---------- 4540 apikey: str 4541 API key provided by Boosted. This key should be protected as a secret. 4542 model_id: str 4543 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4544 button next to your model's name in the Model Summary Page in Boosted 4545 Insights. 4546 portfolio_id: str 4547 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4548 date: datetime.date | str 4549 Date for which to fetch data. Defaults to "today". 4550 use_v2: bool 4551 Whether to use the "V2" version of risk factors data. 4552 proxy: str 4553 Your organization may require the use of a proxy for access. 4554 The address of a HTTPS proxy in the format of <address>:<port>. 4555 Examples are "123.456.789:123" or "my.proxy.com:123". 4556 Do not prepend with "https://". 4557 disable_verify_ssl: bool 4558 Your networking setup may be behind a firewall which performs SSL 4559 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4560 to point to the location of a custom certificate bundle, or set this 4561 parameter to true to disable SSL verification as a workaround. 4562 4563 Returns 4564 ------- 4565 A dataframe with the following columns: 4566 4567 level: int 4568 An integer indicating the depth/level of that row (0 for sectors, 1 for 4569 securities). 4570 identifier: str 4571 Sector/security identifier. 4572 stock_count: int 4573 Total number of stocks in the sector/industry. For security rows, will 4574 be 1. 4575 volatility: float 4576 exposure: float 4577 rating: float 4578 rating_delta: float 4579 """ 4580 date = convert_date(date) 4581 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4582 return client.get_risk_factors_discovered_descriptors(model_id, portfolio_id, date, use_v2)
Given a model and portfolio, returns the calculated semantic risk discovered descriptors.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch data. Defaults to "today". use_v2: bool Whether to use the "V2" version of risk factors data. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dataframe with the following columns:
level: int An integer indicating the depth/level of that row (0 for sectors, 1 for securities). identifier: str Sector/security identifier. stock_count: int Total number of stocks in the sector/industry. For security rows, will be 1. volatility: float exposure: float rating: float rating_delta: float
4585def getRiskFactorsSectors( 4586 apikey: str, 4587 model_id: str, 4588 portfolio_id: str, 4589 date: BoostedDate = datetime.date.today(), 4590 proxy: Optional[str] = None, 4591 disable_verify_ssl: bool = False, 4592 use_v2: bool = False, 4593) -> pd.DataFrame: 4594 """ 4595 Given a model and portfolio, returns the calculated semantic risk sectors. 4596 4597 Parameters 4598 ---------- 4599 apikey: str 4600 API key provided by Boosted. This key should be protected as a secret. 4601 model_id: str 4602 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4603 button next to your model's name in the Model Summary Page in Boosted 4604 Insights. 4605 portfolio_id: str 4606 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4607 date: datetime.date | str 4608 Date for which to fetch data. Defaults to "today". 4609 use_v2: bool 4610 Whether to use the "V2" version of risk factors data. 4611 proxy: str 4612 Your organization may require the use of a proxy for access. 4613 The address of a HTTPS proxy in the format of <address>:<port>. 4614 Examples are "123.456.789:123" or "my.proxy.com:123". 4615 Do not prepend with "https://". 4616 disable_verify_ssl: bool 4617 Your networking setup may be behind a firewall which performs SSL 4618 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4619 to point to the location of a custom certificate bundle, or set this 4620 parameter to true to disable SSL verification as a workaround. 4621 4622 Returns 4623 ------- 4624 A dataframe with the following columns: 4625 4626 level: int 4627 An integer indicating the depth/level of that row (0 for sectors, 1 for 4628 industry groups, 2 for industries). 4629 identifier: str 4630 Sector/Industry group/Industry identifier. 4631 stock_count: int 4632 Total number of stocks in the sector/industry. 4633 volatility: float 4634 exposure: float 4635 rating: float 4636 rating_delta: float 4637 """ 4638 date = convert_date(date) 4639 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4640 return client.get_risk_factors_sectors(model_id, portfolio_id, date, use_v2)
Given a model and portfolio, returns the calculated semantic risk sectors.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch data. Defaults to "today". use_v2: bool Whether to use the "V2" version of risk factors data. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dataframe with the following columns:
level: int An integer indicating the depth/level of that row (0 for sectors, 1 for industry groups, 2 for industries). identifier: str Sector/Industry group/Industry identifier. stock_count: int Total number of stocks in the sector/industry. volatility: float exposure: float rating: float rating_delta: float
4643def downloadCompletePortfolioData( 4644 apikey: str, 4645 model_id: str, 4646 portfolio_id: str, 4647 download_filepath: Optional[str] = None, 4648 proxy: Optional[str] = None, 4649 disable_verify_ssl: bool = False, 4650): 4651 """ 4652 Given a model and portfolio, downloads the complete portfolio data as an 4653 excel file to the specified download path. 4654 4655 Parameters 4656 ---------- 4657 apikey: str 4658 API key provided by Boosted. This key should be protected as a secret. 4659 model_id: str 4660 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4661 button next to your model's name in the Model Summary Page in Boosted 4662 Insights. 4663 portfolio_id: str 4664 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4665 download_filepath: Optional[str] 4666 File path to download model data file to. If not present, will default 4667 to a file named after the model_id in the current directory. 4668 proxy: str 4669 Your organization may require the use of a proxy for access. 4670 The address of a HTTPS proxy in the format of <address>:<port>. 4671 Examples are "123.456.789:123" or "my.proxy.com:123". 4672 Do not prepend with "https://". 4673 disable_verify_ssl: bool 4674 Your networking setup may be behind a firewall which performs SSL 4675 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4676 to point to the location of a custom certificate bundle, or set this 4677 parameter to true to disable SSL verification as a workaround. 4678 """ 4679 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4680 if download_filepath is None: 4681 download_filepath = f"{model_id}.xlsx" 4682 client.download_complete_portfolio_data(model_id, portfolio_id, download_filepath)
Given a model and portfolio, downloads the complete portfolio data as an excel file to the specified download path.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. download_filepath: Optional[str] File path to download model data file to. If not present, will default to a file named after the model_id in the current directory. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:4685def diffHedgeExperimentPortfolioData( 4686 apikey: str, 4687 experiment_id: str, 4688 comparison_portfolios: List[str], 4689 categories: Optional[List[str]] = None, 4690 proxy: Optional[str] = None, 4691 disable_verify_ssl: bool = False, 4692) -> Dict: 4693 """ 4694 Differences portfolios, returning data relative to the baseline. 4695 4696 This function supports differencing multiple portfolios against the 4697 baseline, such that diff_i = cmp_pf_i - baseline. Differences are 4698 calculated element-wise on a per-category basis. 4699 4700 Currently, this function only works for hedge experiment portfolios. 4701 4702 Parameters 4703 ---------- 4704 apikey: str 4705 API key provided by Boosted. This key should be protected as a secret. 4706 experiment_id: str 4707 Hedge experiment id 4708 comparison_portfolios: List[str] 4709 List of portfolios to be diffed against the current baseline. 4710 categories: List[str] 4711 Specifier of what data to difference. Passing a smaller, desired 4712 subset can improve performance. Options include: 4713 ["performanceGrid", "performance", "factors", "volatility"] 4714 proxy: str 4715 Your organization may require the use of a proxy for access. 4716 The address of a HTTPS proxy in the format of <address>:<port>. 4717 Examples are "123.456.789:123" or "my.proxy.com:123". 4718 Do not prepend with "https://". 4719 disable_verify_ssl: bool 4720 Your networking setup may be behind a firewall which performs SSL 4721 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4722 to point to the location of a custom certificate bundle, or set this 4723 parameter to true to disable SSL verification as a workaround. 4724 4725 Returns 4726 ------- 4727 Dictionary: 4728 { 4729 "factors": Optional[pd.DataFrame], 4730 "volatility":Optional[pd.DataFrame], 4731 "performance": Optional[pd.DataFrame], 4732 "performanceGrid": Optional[pd.DataFrame] 4733 } 4734 """ 4735 4736 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4737 DIFF_CATEGORIES = ["performance", "performanceGrid", "volatility", "factors"] 4738 if categories is None: 4739 categories = DIFF_CATEGORIES 4740 else: 4741 for cat in categories: 4742 if cat not in DIFF_CATEGORIES: 4743 raise ValueError(f"Unexpected category {cat}") 4744 diff = client.diff_hedge_experiment_portfolio_data( 4745 experiment_id, comparison_portfolios, categories 4746 ) 4747 return diff
Differences portfolios, returning data relative to the baseline.
This function supports differencing multiple portfolios against the baseline, such that diff_i = cmp_pf_i - baseline. Differences are calculated element-wise on a per-category basis.
Currently, this function only works for hedge experiment portfolios.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_id: str Hedge experiment id comparison_portfolios: List[str] List of portfolios to be diffed against the current baseline. categories: List[str] Specifier of what data to difference. Passing a smaller, desired subset can improve performance. Options include: ["performanceGrid", "performance", "factors", "volatility"] proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary: { "factors": Optional[pd.DataFrame], "volatility":Optional[pd.DataFrame], "performance": Optional[pd.DataFrame], "performanceGrid": Optional[pd.DataFrame] }
4750def getSignalStrength( 4751 apikey: str, 4752 model_id: str, 4753 portfolio_id: str, 4754 proxy: Optional[str] = None, 4755 disable_verify_ssl: bool = False, 4756) -> pd.DataFrame: 4757 """ 4758 Retrieves portfolio signals data and returns as a pandas dataframe. 4759 4760 Parameters 4761 ---------- 4762 apikey: str 4763 API key provided by Boosted. This key should be protected as a secret. 4764 model_id: str 4765 UUID of a Boosted model. 4766 portfolio_id: str 4767 UUID of a Boosted portfolio in the given model. 4768 proxy: str 4769 Your organization may require the use of a proxy for access. 4770 The address of a HTTPS proxy in the format of <address>:<port>. 4771 Examples are "123.456.789:123" or "my.proxy.com:123". 4772 Do not prepend with "https://". 4773 disable_verify_ssl: bool 4774 Your networking setup may be behind a firewall which performs SSL 4775 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4776 to point to the location of a custom certificate bundle, or set this 4777 parameter to true to disable SSL verification as a workaround. 4778 4779 Returns 4780 ------- 4781 Pandas Dataframe indexed by date with columns: 4782 5D, 10D, 21D, 63D, 126D, 189D, 252D, 315D, 378D, 441D, 504D, TimeHorizon 4783 """ 4784 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4785 return client.get_signal_strength(model_id, portfolio_id)
Retrieves portfolio signals data and returns as a pandas dataframe.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by date with columns: 5D, 10D, 21D, 63D, 126D, 189D, 252D, 315D, 378D, 441D, 504D, TimeHorizon
4788def getRollingSignalStrength( 4789 apikey: str, 4790 model_id: str, 4791 portfolio_id: str, 4792 proxy: Optional[str] = None, 4793 disable_verify_ssl: bool = False, 4794): 4795 """ 4796 Retrieves portfolio rolling signals data and returns as a pandas dataframe. 4797 4798 Parameters 4799 ---------- 4800 apikey: str 4801 API key provided by Boosted. This key should be protected as a secret. 4802 model_id: str 4803 UUID of a Boosted model. 4804 portfolio_id: str 4805 UUID of a Boosted portfolio in the given model. 4806 proxy: str 4807 Your organization may require the use of a proxy for access. 4808 The address of a HTTPS proxy in the format of <address>:<port>. 4809 Examples are "123.456.789:123" or "my.proxy.com:123". 4810 Do not prepend with "https://". 4811 disable_verify_ssl: bool 4812 Your networking setup may be behind a firewall which performs SSL 4813 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4814 to point to the location of a custom certificate bundle, or set this 4815 parameter to true to disable SSL verification as a workaround. 4816 4817 Returns 4818 ------- 4819 Pandas Dataframe indexed by date with columns: 4820 Avg5D 4821 Avg10D 4822 Avg21D 4823 Avg63D 4824 Avg126D 4825 Avg189D 4826 Avg252D 4827 Avg315D 4828 Avg378D 4829 Avg441D 4830 Avg504D 4831 Avgtime Horizon 4832 """ 4833 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4834 return client.get_rolling_signal_strength(model_id, portfolio_id)
Retrieves portfolio rolling signals data and returns as a pandas dataframe.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by date with columns: Avg5D Avg10D Avg21D Avg63D Avg126D Avg189D Avg252D Avg315D Avg378D Avg441D Avg504D Avgtime Horizon
4837def getPortfolioFactorAttribution( 4838 apikey: str, 4839 portfolio_id: str, 4840 start_date: Optional[BoostedDate] = None, 4841 end_date: Optional[BoostedDate] = None, 4842 proxy: Optional[str] = None, 4843 disable_verify_ssl: bool = False, 4844): 4845 """Get factor attribution for a portfolio. 4846 Factor attribution is the methodology of using a stock or strategy’s 4847 factor exposure to explain its risk and reward. 4848 4849 Patameters 4850 ---------- 4851 apikey: str : 4852 API key provided by Boosted. This key should be protected as a secret. 4853 portfolio_id: str 4854 UUID of a Boosted portfolio in the given model. 4855 start_date: datetime.date | str 4856 Starting date for which trades should be fetched. 4857 Default to the first date of the portfolio. 4858 end_date: datetime.date | str 4859 Ending date for which trades should be fetched. 4860 Default to the latest date of the portfolio. 4861 proxy: str 4862 Your organization may require the use of a proxy for access. 4863 The address of a HTTPS proxy in the format of <address>:<port>. 4864 Examples are "123.456.789:123" or "my.proxy.com:123". 4865 Do not prepend with "https://". 4866 disable_verify_ssl: bool 4867 Your networking setup may be behind a firewall which performs SSL 4868 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4869 to point to the location of a custom certificate bundle, or set this 4870 parameter to true to disable SSL verification as a workaround. 4871 4872 Returns 4873 ------- 4874 A Pandas Dataframe indexed by date with each factor attribution per column. 4875 The <factor attribution>_return columns are percentages. 4876 For example, 0.05 of `volatility_return` means the return for volatility is 0.05%. 4877 """ 4878 client = BoostedClient(api_key=apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4879 return client.get_portfolio_factor_attribution( 4880 portfolio_id=portfolio_id, 4881 start_date=start_date, 4882 end_date=end_date, 4883 )
Get factor attribution for a portfolio. Factor attribution is the methodology of using a stock or strategy’s factor exposure to explain its risk and reward.
Patameters
apikey: str : API key provided by Boosted. This key should be protected as a secret. portfolio_id: str UUID of a Boosted portfolio in the given model. start_date: datetime.date | str Starting date for which trades should be fetched. Default to the first date of the portfolio. end_date: datetime.date | str Ending date for which trades should be fetched. Default to the latest date of the portfolio. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A Pandas Dataframe indexed by date with each factor attribution per column.
The volatility_return
means the return for volatility is 0.05%.
4886def getPortfolioQuantiles( 4887 apikey: str, 4888 model_id: str, 4889 portfolio_id: str, 4890 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4891 proxy: Optional[str] = None, 4892 disable_verify_ssl: bool = False, 4893): 4894 """ 4895 Get quantile data for a portfolio. 4896 4897 Parameters 4898 ---------- 4899 apikey: str 4900 API key provided by Boosted. This key should be protected as a secret. 4901 model_id: str 4902 UUID of a Boosted model. 4903 portfolio_id: str 4904 UUID of a Boosted portfolio in the given model. 4905 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4906 Whether the column names are ISIN's or tickers in the output dataframe. 4907 proxy: str 4908 Your organization may require the use of a proxy for access. 4909 The address of a HTTPS proxy in the format of <address>:<port>. 4910 Examples are "123.456.789:123" or "my.proxy.com:123". 4911 Do not prepend with "https://". 4912 disable_verify_ssl: bool 4913 Your networking setup may be behind a firewall which performs SSL 4914 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4915 to point to the location of a custom certificate bundle, or set this 4916 parameter to true to disable SSL verification as a workaround. 4917 4918 Returns 4919 ------- 4920 Pandas Dataframe indexed by date with each one security per column. 4921 """ 4922 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4923 return client.get_portfolio_quantiles( 4924 model_id=model_id, 4925 portfolio_id=portfolio_id, 4926 id_type=id_type, 4927 )
Get quantile data for a portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. id_type: Literal["TICKER", "ISIN"] = "TICKER", Whether the column names are ISIN's or tickers in the output dataframe. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by date with each one security per column.
4930def getSimilarStocks( 4931 apikey: str, 4932 model_id: str, 4933 portfolio_id: str, 4934 identifiers: List[str], 4935 date: BoostedDate, 4936 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4937 proxy: Optional[str] = None, 4938 disable_verify_ssl: bool = False, 4939 preferred_country: Optional[str] = None, 4940 preferred_currency: Optional[str] = None, 4941) -> pd.DataFrame: 4942 """ 4943 Get the stock similarity data for a basket of stocks. 4944 4945 Parameters 4946 ---------- 4947 apikey: str 4948 API key provided by Boosted. This key should be protected as a secret. 4949 model_id: str 4950 UUID of a Boosted model. 4951 portfolio_id: str 4952 UUID of a Boosted portfolio in the given model. 4953 identifiers: List[str] 4954 List of identifiers that represent the input basket of stocks, can be 4955 either ISIN's or Tickers. 4956 date: Optional[datetime.date | str] 4957 Date for which similarity data should be fetched. 4958 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4959 Should be set to whatever identifier type is input. Defaults to TICKER. 4960 preferred_country: str 4961 The preferred country for the identifier list, to resolve 4962 abiguities. Should be a 3 character iso code. By default, will try to 4963 figure out the best match. 4964 preferred_currency: str 4965 The preferred currency for the identifier list, to resolve 4966 abiguities. Should be a 3 character iso code. By default, will try to 4967 figure out the best match. 4968 proxy: str 4969 Your organization may require the use of a proxy for access. 4970 The address of a HTTPS proxy in the format of <address>:<port>. 4971 Examples are "123.456.789:123" or "my.proxy.com:123". 4972 Do not prepend with "https://". 4973 disable_verify_ssl: bool 4974 Your networking setup may be behind a firewall which performs SSL 4975 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4976 to point to the location of a custom certificate bundle, or set this 4977 parameter to true to disable SSL verification as a workaround. 4978 4979 Returns 4980 ------- 4981 Pandas Dataframe indexed by identifier with a row for every security in the 4982 portfolio (except for those in the input basket). DataFrame will contain 4983 columns: 4984 - overallSimilarityScore: float 4985 - priceSimilarityScore: float 4986 - factorSimilarityScore: float 4987 - correlation: float 4988 """ 4989 4990 if identifier_type not in ["TICKER", "ISIN"]: 4991 raise ValueError( 4992 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4993 ) 4994 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4995 return client.get_similar_stocks( 4996 model_id=model_id, 4997 portfolio_id=portfolio_id, 4998 symbol_list=identifiers, 4999 date=date, 5000 identifier_type=identifier_type, 5001 preferred_country=preferred_country, 5002 preferred_currency=preferred_currency, 5003 )
Get the stock similarity data for a basket of stocks.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. identifiers: List[str] List of identifiers that represent the input basket of stocks, can be either ISIN's or Tickers. date: Optional[datetime.date | str] Date for which similarity data should be fetched. identifier_type: Literal["TICKER", "ISIN"] = "TICKER", Should be set to whatever identifier type is input. Defaults to TICKER. preferred_country: str The preferred country for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. preferred_currency: str The preferred currency for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by identifier with a row for every security in the portfolio (except for those in the input basket). DataFrame will contain columns:
- overallSimilarityScore: float
- priceSimilarityScore: float
- factorSimilarityScore: float
- correlation: float
5006def getPortfolioTrades( 5007 apikey: str, 5008 model_id: str, 5009 portfolio_id: str, 5010 start_date: Optional[BoostedDate] = None, 5011 end_date: Optional[BoostedDate] = None, 5012 proxy: Optional[str] = None, 5013 disable_verify_ssl: bool = False, 5014) -> pd.DataFrame: 5015 """ 5016 Get the list of trades for a portfolio. NOTE: The max date range is 7 years, 5017 any larger will return an error. 5018 5019 Parameters 5020 ---------- 5021 apikey: str 5022 API key provided by Boosted. This key should be protected as a secret. 5023 model_id: str 5024 UUID of a Boosted model. 5025 portfolio_id: str 5026 UUID of a Boosted portfolio in the given model. 5027 start_date: Optional[datetime.date | str] 5028 Starting date for which trades should be fetched. 5029 end_date: Optional[datetime.date | str] 5030 Ending date for which trades should be fetched. 5031 proxy: str 5032 Your organization may require the use of a proxy for access. 5033 The address of a HTTPS proxy in the format of <address>:<port>. 5034 Examples are "123.456.789:123" or "my.proxy.com:123". 5035 Do not prepend with "https://". 5036 disable_verify_ssl: bool 5037 Your networking setup may be behind a firewall which performs SSL 5038 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5039 to point to the location of a custom certificate bundle, or set this 5040 parameter to true to disable SSL verification as a workaround. 5041 5042 Returns 5043 ------- 5044 Pandas Dataframe, each row containing data for a security + date. 5045 Columns are: 5046 - isin: str 5047 - ticker: str 5048 - date: datetime.date 5049 - price: float 5050 - shares_owned: float 5051 - shares_traded: float 5052 """ 5053 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5054 return client.get_portfolio_trades( 5055 model_id=model_id, 5056 portfolio_id=portfolio_id, 5057 start_date=start_date, 5058 end_date=end_date, 5059 )
Get the list of trades for a portfolio. NOTE: The max date range is 7 years, any larger will return an error.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. start_date: Optional[datetime.date | str] Starting date for which trades should be fetched. end_date: Optional[datetime.date | str] Ending date for which trades should be fetched. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe, each row containing data for a security + date. Columns are:
- isin: str
- ticker: str
- date: datetime.date
- price: float
- shares_owned: float
- shares_traded: float
5062def getIdeas( 5063 apikey: str, 5064 model_id: str, 5065 portfolio_id: str, 5066 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5067 delta_horizon: Literal["1M", "3M", "6M", "9M", "1Y"] = "1M", 5068 proxy: Optional[str] = None, 5069 disable_verify_ssl: bool = False, 5070) -> pd.DataFrame: 5071 """ 5072 Given a model ID, portfolio ID, and a time horizon, return a dataframe of 5073 stock ideas. 5074 5075 Parameters 5076 ---------- 5077 apikey: str 5078 API key provided by Boosted. This key should be protected as a secret. 5079 model_id: str 5080 UUID of a Boosted model. 5081 portfolio_id: str 5082 UUID of a Boosted portfolio in the given model. 5083 investment_horizon: str 5084 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5085 delta_horizon: str 5086 Time period over which to compute deltas. Can be "1M", "3M", "6M", "9M", "1Y". 5087 proxy: str 5088 Your organization may require the use of a proxy for access. 5089 The address of a HTTPS proxy in the format of <address>:<port>. 5090 Examples are "123.456.789:123" or "my.proxy.com:123". 5091 Do not prepend with "https://". 5092 disable_verify_ssl: bool 5093 Your networking setup may be behind a firewall which performs SSL 5094 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5095 to point to the location of a custom certificate bundle, or set this 5096 parameter to true to disable SSL verification as a workaround. 5097 5098 Returns 5099 ------- 5100 Pandas Dataframe, each row containing data for a security. The dataframe is 5101 indexed by ticker. 5102 Columns are: 5103 - recommendation: str 5104 - rating: float 5105 - rating_delta: float 5106 - dividend_yield: float 5107 - predicted_excess_return_1m: float 5108 - predicted_excess_return_3m: float 5109 - predicted_excess_return_1y: float 5110 - risk: str 5111 - reward: str 5112 - reason: str 5113 """ 5114 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5115 return client.get_ideas( 5116 model_id=model_id, 5117 portfolio_id=portfolio_id, 5118 investment_horizon=investment_horizon, 5119 delta_horizon=delta_horizon, 5120 )
Given a model ID, portfolio ID, and a time horizon, return a dataframe of stock ideas.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. investment_horizon: str Investment time horizon for the ideas. Can be "1M", "3M", "1Y". delta_horizon: str Time period over which to compute deltas. Can be "1M", "3M", "6M", "9M", "1Y". proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe, each row containing data for a security. The dataframe is indexed by ticker. Columns are:
- recommendation: str
- rating: float
- rating_delta: float
- dividend_yield: float
- predicted_excess_return_1m: float
- predicted_excess_return_3m: float
- predicted_excess_return_1y: float
- risk: str
- reward: str
- reason: str
5123def getStockRecommendations( 5124 apikey: str, 5125 model_id: str, 5126 portfolio_id: str, 5127 symbols: Optional[List[str]] = None, 5128 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5129 proxy: Optional[str] = None, 5130 disable_verify_ssl: bool = False, 5131) -> pd.DataFrame: 5132 """ 5133 Given a model ID, portfolio ID, optional list of symbols, and a time 5134 horizon, return a dictionary of symbols to stock recommendations. 5135 5136 Parameters 5137 ---------- 5138 apikey: str 5139 API key provided by Boosted. This key should be protected as a secret. 5140 model_id: str 5141 UUID of a Boosted model. 5142 portfolio_id: str 5143 UUID of a Boosted portfolio in the given model. 5144 symbols: Optional[List[str]] 5145 List of symbols for which to fetch recommendation info. If None, will 5146 return recommendations for the entire portfolio. Note that invalid 5147 symbols or symbols without recommendations will not be returned. 5148 investment_horizon: str 5149 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5150 proxy: str 5151 Your organization may require the use of a proxy for access. 5152 The address of a HTTPS proxy in the format of <address>:<port>. 5153 Examples are "123.456.789:123" or "my.proxy.com:123". 5154 Do not prepend with "https://". 5155 disable_verify_ssl: bool 5156 Your networking setup may be behind a firewall which performs SSL 5157 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5158 to point to the location of a custom certificate bundle, or set this 5159 parameter to true to disable SSL verification as a workaround. 5160 5161 Returns 5162 ------- 5163 Pandas Dataframe, each row containing data for a security. The dataframe is 5164 indexed by ticker. The "reasons" column is a dict from a reason's "title" to 5165 its text. 5166 Columns are: 5167 - recommendation: str 5168 - predicted_excess_return_1m: float 5169 - predicted_excess_return_3m: float 5170 - predicted_excess_return_1y: float 5171 - risk: str 5172 - reward: str 5173 - reasons: Dict[str, str] 5174 """ 5175 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5176 return client.get_stock_recommendations( 5177 model_id=model_id, 5178 portfolio_id=portfolio_id, 5179 symbols=symbols, 5180 investment_horizon=investment_horizon, 5181 )
Given a model ID, portfolio ID, optional list of symbols, and a time horizon, return a dictionary of symbols to stock recommendations.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. symbols: Optional[List[str]] List of symbols for which to fetch recommendation info. If None, will return recommendations for the entire portfolio. Note that invalid symbols or symbols without recommendations will not be returned. investment_horizon: str Investment time horizon for the ideas. Can be "1M", "3M", "1Y". proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe, each row containing data for a security. The dataframe is indexed by ticker. The "reasons" column is a dict from a reason's "title" to its text. Columns are:
- recommendation: str
- predicted_excess_return_1m: float
- predicted_excess_return_3m: float
- predicted_excess_return_1y: float
- risk: str
- reward: str
- reasons: Dict[str, str]
5184def getStockRecommendationReasons( 5185 apikey: str, 5186 model_id: str, 5187 portfolio_id: str, 5188 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5189 symbols: Optional[List[str]] = None, 5190 proxy: Optional[str] = None, 5191 disable_verify_ssl: bool = False, 5192) -> Dict[str, Optional[List[str]]]: 5193 """ 5194 Given a model ID, portfolio ID, symbols, and a time horizon, return a dictionary 5195 of symbols to stock recommendations. 5196 5197 Parameters 5198 ---------- 5199 apikey: str 5200 API key provided by Boosted. This key should be protected as a secret. 5201 model_id: str 5202 UUID of a Boosted model. 5203 portfolio_id: str 5204 UUID of a Boosted portfolio in the given model. 5205 symbols: List[str] 5206 Optional list of symbols for which to fetch reasons. If None, all symbols 5207 for the given portfolio are fetched. 5208 investment_horizon: str 5209 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5210 proxy: str 5211 Your organization may require the use of a proxy for access. 5212 The address of a HTTPS proxy in the format of <address>:<port>. 5213 Examples are "123.456.789:123" or "my.proxy.com:123". 5214 Do not prepend with "https://". 5215 disable_verify_ssl: bool 5216 Your networking setup may be behind a firewall which performs SSL 5217 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5218 to point to the location of a custom certificate bundle, or set this 5219 parameter to true to disable SSL verification as a workaround. 5220 5221 Returns 5222 ------- 5223 Dictionary: 5224 { 5225 <symbol_0>: [reason_0, reason_1, ...], 5226 <symbol_1>: [reason_0, reason_1, ...] 5227 } 5228 Note that for a passed symbol that has no reasons, the symbol will be present 5229 in the dictionary but will not have any elements in its list, i.e. 5230 >>> print(result["SOME_SYMBOL_WITH_NO_REASONS"]) 5231 [] 5232 Additionally, if a passed symbol is not found as a portfolio holding, the symbol 5233 will be present in the dictionary but will be valued None, i.e. 5234 >>> print(result["SOME_SYMBOL_NOT_FOUND"]) 5235 None 5236 """ 5237 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5238 return client.get_stock_recommendation_reasons( 5239 model_id=model_id, 5240 portfolio_id=portfolio_id, 5241 investment_horizon=investment_horizon, 5242 symbols=symbols, 5243 )
Given a model ID, portfolio ID, symbols, and a time horizon, return a dictionary of symbols to stock recommendations.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. symbols: List[str] Optional list of symbols for which to fetch reasons. If None, all symbols for the given portfolio are fetched. investment_horizon: str Investment time horizon for the ideas. Can be "1M", "3M", "1Y". proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary:
{
print(result["SOME_SYMBOL_WITH_NO_REASONS"]) [] Additionally, if a passed symbol is not found as a portfolio holding, the symbol will be present in the dictionary but will be valued None, i.e. print(result["SOME_SYMBOL_NOT_FOUND"]) None
5246def get_stock_mapping_alternatives( 5247 self, 5248 apikey: str, 5249 isin: Optional[str] = None, 5250 symbol: Optional[str] = None, 5251 country: Optional[str] = None, 5252 currency: Optional[str] = None, 5253 asof_date: Optional[BoostedDate] = None, 5254 proxy: Optional[str] = None, 5255 disable_verify_ssl: bool = False, 5256) -> Dict: 5257 """ 5258 Return the stock mapping for the given criteria, 5259 also suggestions for alternate matches, 5260 if the mapping is not what is wanted 5261 5262 Parameters [One of either ISIN or SYMBOL must be provided] 5263 ---------- 5264 isin: Optional[str] 5265 search by ISIN 5266 symbol: Optional[str] 5267 search by Ticker Symbol 5268 country: Optional[str] 5269 Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" 5270 currency: Optional[str] 5271 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5272 asof_date: Optional[date] 5273 as of which date to perform the search, default is today() 5274 5275 Note: country/currency filter starting with "p_" indicates 5276 only a soft preference but allows other matches 5277 5278 Returns 5279 ------- 5280 Dictionary Representing this 'MapSecurityResponse' structure: 5281 5282 class MapSecurityResponse(): 5283 stock_mapping: Optional[SecurityInfo] 5284 The mapping we would perform given your inputs 5285 5286 alternatives: Optional[List[SecurityInfo]] 5287 Alternative suggestions based on your input 5288 5289 error: Optional[str] 5290 5291 class SecurityInfo(): 5292 gbi_id: int 5293 isin: str 5294 symbol: Optional[str] 5295 country: str 5296 currency: str 5297 name: str 5298 from_date: date 5299 to_date: date 5300 is_primary_trading_item: bool 5301 5302 """ 5303 5304 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5305 return client.get_stock_mapping_alternatives( 5306 isin=isin, symbol=symbol, country=country, currency=currency, asof_date=asof_date 5307 )
Return the stock mapping for the given criteria, also suggestions for alternate matches, if the mapping is not what is wanted
Parameters [One of either ISIN or SYMBOL must be provided]
----------
isin: Optional[str]
search by ISIN
symbol: Optional[str]
search by Ticker Symbol
country: Optional[str]
Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN"
currency: Optional[str]
Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD"
asof_date: Optional[date]
as of which date to perform the search, default is today()
Note: country/currency filter starting with "p_" indicates
only a soft preference but allows other matches
Returns
Dictionary Representing this 'MapSecurityResponse' structure:
class MapSecurityResponse(): stock_mapping: Optional[SecurityInfo] The mapping we would perform given your inputs
alternatives: Optional[List[SecurityInfo]]
Alternative suggestions based on your input
error: Optional[str]
class SecurityInfo(): gbi_id: int isin: str symbol: Optional[str] country: str currency: str name: str from_date: date to_date: date is_primary_trading_item: bool
5310def getProsConsForStocks( 5311 apikey: str, 5312 model_id: Optional[str] = None, 5313 symbols: Optional[List[str]] = None, 5314 preferred_country: Optional[str] = None, 5315 preferred_currency: Optional[str] = None, 5316 proxy: Optional[str] = None, 5317 disable_verify_ssl: bool = False, 5318) -> Dict[str, Dict[str, List]]: 5319 """ 5320 Given a model ID OR a list of symbols, return pros/cons for 5321 each stock. Note that unrecognized symbols will be absent from the output. 5322 5323 Parameters 5324 ---------- 5325 apikey: str 5326 API key provided by Boosted. This key should be protected as a secret. 5327 model_id: Optional[str] 5328 UUID of a Boosted model. 5329 symbols: Optional[List[str]] 5330 List of symbols for which to fetch pros/cons. 5331 preferred_country: str 5332 The preferred country for the identifier list, to resolve 5333 abiguities. Should be a 3 character iso code. By default, will try to 5334 figure out the best match. 5335 preferred_currency: str 5336 The preferred currency for the identifier list, to resolve 5337 abiguities. Should be a 3 character iso code. By default, will try to 5338 figure out the best match. 5339 proxy: str 5340 Your organization may require the use of a proxy for access. 5341 The address of a HTTPS proxy in the format of <address>:<port>. 5342 Examples are "123.456.789:123" or "my.proxy.com:123". 5343 Do not prepend with "https://". 5344 disable_verify_ssl: bool 5345 Your networking setup may be behind a firewall which performs SSL 5346 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5347 to point to the location of a custom certificate bundle, or set this 5348 parameter to true to disable SSL verification as a workaround. 5349 5350 Returns 5351 ------- 5352 Dictionary in the following format 5353 { "SYMBOL": 5354 { 5355 "pros": [ 5356 { 5357 "summary": "Increase in service revenue", 5358 "details": "Details..." 5359 }, 5360 ], 5361 "cons": [ 5362 { 5363 "summary": "Increase in cost of vehicle sales", 5364 "details": "Details..." 5365 }, 5366 ] 5367 } 5368 } 5369 """ 5370 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5371 if symbols is None and model_id is None: 5372 raise BoostedAPIException("Must provide either a list of symbols or a model/portfolio") 5373 return client.get_pros_cons_for_stocks( 5374 symbols=symbols, 5375 model_id=model_id, 5376 preferred_country=preferred_country, 5377 preferred_currency=preferred_currency, 5378 )
Given a model ID OR a list of symbols, return pros/cons for each stock. Note that unrecognized symbols will be absent from the output.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: Optional[str] UUID of a Boosted model. symbols: Optional[List[str]] List of symbols for which to fetch pros/cons. preferred_country: str The preferred country for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. preferred_currency: str The preferred currency for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary in the following format { "SYMBOL": { "pros": [ { "summary": "Increase in service revenue", "details": "Details..." }, ], "cons": [ { "summary": "Increase in cost of vehicle sales", "details": "Details..." }, ] } }
5384def generateTheme( 5385 apikey: str, 5386 theme_name: str, 5387 stock_universes: List[ThemeUniverse], 5388 proxy: Optional[str] = None, 5389 disable_verify_ssl: bool = False, 5390) -> str: 5391 """ 5392 The API to generate a theme for a list of stock universes. 5393 5394 Parameters 5395 ---------- 5396 apikey: str 5397 API key provided by Boosted. This key should be protected as a secret. 5398 theme_name: str 5399 The name of the theme to generate. 5400 stock_universes: List[ThemeUniverse] 5401 The universe of stocks to use for the theme. We currently support the universes in the enum 5402 class `ThemeUniverse`. 5403 proxy: str 5404 Your organization may require the use of a proxy for access. 5405 The address of a HTTPS proxy in the format of <address>:<port>. 5406 Examples are "123.456.789:123" or "my.proxy.com:123". 5407 Do not prepend with "https://". 5408 disable_verify_ssl: bool 5409 Your networking setup may be behind a firewall which performs SSL 5410 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5411 to point to the location of a custom certificate bundle, or set this 5412 parameter to true to disable SSL verification as a workaround. 5413 5414 Returns 5415 ------- 5416 a string of theme id that can be used to query the theme data later. 5417 """ 5418 if not stock_universes: 5419 raise BoostedAPIException("Must provide a list of stock universe IDs") 5420 5421 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5422 return client.generate_theme(theme_name, stock_universes)
The API to generate a theme for a list of stock universes.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
theme_name: str
The name of the theme to generate.
stock_universes: List[ThemeUniverse]
The universe of stocks to use for the theme. We currently support the universes in the enum
class ThemeUniverse
.
proxy: str
Your organization may require the use of a proxy for access.
The address of a HTTPS proxy in the format of
Returns
a string of theme id that can be used to query the theme data later.
5425def getThemesForStock( 5426 apikey: str, 5427 isin: str, 5428 currency: Optional[str] = None, 5429 country: Optional[str] = None, 5430 start_date: Optional[BoostedDate] = None, 5431 end_date: Optional[BoostedDate] = None, 5432 language: Optional[Union[str, Language]] = None, 5433 proxy: Optional[str] = None, 5434 disable_verify_ssl: bool = False, 5435) -> List[Dict]: 5436 """ 5437 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5438 5439 Parameters 5440 ---------- 5441 apikey: str 5442 API key provided by Boosted. This key should be protected as a secret. 5443 isin: str 5444 The ISIN of the stock to get themes for. 5445 currency: Optional[str] 5446 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5447 "ANY", "p_USA", "CAN" 5448 country: Optional[str] 5449 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5450 start_date & end_date: Optional[BoostedDate] 5451 The start and end date to calculate the theme importance. If not provided, the default is 5452 the past 30 days. 5453 language: Optional[str | Language] 5454 Will translate AI generated text into the given language. This may be a 5455 language in the Language enum or any language code supported by Google 5456 Translate. 5457 proxy: str 5458 Your organization may require the use of a proxy for access. 5459 The address of a HTTPS proxy in the format of <address>:<port>. 5460 Examples are "123.456.789:123" or "my.proxy.com:123". 5461 Do not prepend with "https://". 5462 disable_verify_ssl: bool 5463 Your networking setup may be behind a firewall which performs SSL 5464 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5465 to point to the location of a custom certificate bundle, or set this 5466 parameter to true to disable SSL verification as a workaround. 5467 5468 Returns 5469 ------- 5470 A list of below dictionaries 5471 { 5472 themeId: str 5473 themeName: str 5474 importanceScore: float 5475 similarityScore: float 5476 positiveThemeRelation: bool 5477 reason: String 5478 } 5479 """ 5480 if (start_date and not end_date) or (end_date and not start_date): 5481 raise BoostedAPIException("Must provide both start and end dates or neither") 5482 5483 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5484 return client.get_themes_for_stock(isin, currency, country, start_date, end_date, language)
The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs)
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin: str The ISIN of the stock to get themes for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of below dictionaries { themeId: str themeName: str importanceScore: float similarityScore: float positiveThemeRelation: bool reason: String }
5487def getThemesForStockUniverse( 5488 apikey: str, 5489 stock_universe: ThemeUniverse, 5490 start_date: Optional[BoostedDate] = None, 5491 end_date: Optional[BoostedDate] = None, 5492 language: Optional[Union[str, Language]] = None, 5493 proxy: Optional[str] = None, 5494 disable_verify_ssl: bool = False, 5495) -> List[Dict]: 5496 """ 5497 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5498 5499 Parameters 5500 ---------- 5501 apikey: str 5502 API key provided by Boosted. This key should be protected as a secret. 5503 stock_universe: ThemeUniverse 5504 The universe of stocks to fetch for themes 5505 start_date & end_date: Optional[BoostedDate] 5506 The start and end date to calculate the theme importance. If not provided, the default is 5507 the past 30 days. 5508 language: Optional[str | Language] 5509 Will translate AI generated text into the given language. This may be a 5510 language in the Language enum or any language code supported by Google 5511 Translate. 5512 proxy: str 5513 Your organization may require the use of a proxy for access. 5514 The address of a HTTPS proxy in the format of <address>:<port>. 5515 Examples are "123.456.789:123" or "my.proxy.com:123". 5516 Do not prepend with "https://". 5517 disable_verify_ssl: bool 5518 Your networking setup may be behind a firewall which performs SSL 5519 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5520 to point to the location of a custom certificate bundle, or set this 5521 parameter to true to disable SSL verification as a workaround. 5522 5523 Returns: A list of below dictionaries 5524 ------- 5525 { 5526 themeId: str 5527 themeName: str 5528 themeImportance: float 5529 volatility: float 5530 positiveStockPerformance: float 5531 negativeStockPerformance: float 5532 } 5533 """ 5534 if (start_date and not end_date) or (end_date and not start_date): 5535 raise BoostedAPIException("Must provide both start and end dates or neither") 5536 5537 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5538 return client.get_themes_for_stock_universe(stock_universe, start_date, end_date, language)
The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs)
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. stock_universe: ThemeUniverse The universe of stocks to fetch for themes start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns: A list of below dictionaries
{ themeId: str themeName: str themeImportance: float volatility: float positiveStockPerformance: float negativeStockPerformance: float }
5541def getStockNews( 5542 apikey: str, 5543 time_horizon: NewsHorizon, 5544 isin: str, 5545 currency: Optional[str] = None, 5546 country: Optional[str] = None, 5547 language: Optional[Union[str, Language]] = None, 5548 proxy: Optional[str] = None, 5549 disable_verify_ssl: bool = False, 5550) -> Dict: 5551 """ 5552 The API to get a stock's news summary for a given time horizon, the topics summarized by these 5553 news and the corresponding news to these topics 5554 Parameters 5555 ---------- 5556 apikey: str 5557 API key provided by Boosted. This key should be protected as a secret. 5558 time_horizon: NewsHorizon 5559 The time horizon for the company's news, summary, topics 5560 isin: str 5561 The ISIN of the stock to get themes for. 5562 currency: Optional[str] 5563 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5564 "ANY", "p_USA", "CAN" 5565 country: Optional[str] 5566 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5567 language: Optional[str | Language] 5568 Will translate AI generated text into the given language. This may be a 5569 language in the Language enum or any language code supported by Google 5570 Translate. 5571 start_date & end_date: Optional[BoostedDate] 5572 The start and end date to calculate the theme importance. If not provided, the default is 5573 the past 30 days. 5574 proxy: str 5575 Your organization may require the use of a proxy for access. 5576 The address of a HTTPS proxy in the format of <address>:<port>. 5577 Examples are "123.456.789:123" or "my.proxy.com:123". 5578 Do not prepend with "https://". 5579 disable_verify_ssl: bool 5580 Your networking setup may be behind a firewall which performs SSL 5581 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5582 to point to the location of a custom certificate bundle, or set this 5583 parameter to true to disable SSL verification as a workaround. 5584 Returns 5585 ------- 5586 A nested dictionary in the following format: 5587 { 5588 summary: str 5589 topics: [ 5590 { 5591 topicId: str 5592 topicLabel: str 5593 topicDescription: str 5594 topicPolarity: str 5595 newsItems: [ 5596 { 5597 newsId: str 5598 headline: str 5599 url: str 5600 summary: str 5601 source: str 5602 publishedAt: str 5603 } 5604 ] 5605 } 5606 ] 5607 other_news_count: int 5608 } 5609 """ 5610 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5611 return client.get_stock_news(time_horizon, isin, currency, country, language)
The API to get a stock's news summary for a given time horizon, the topics summarized by these news and the corresponding news to these topics
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. time_horizon: NewsHorizon The time horizon for the company's news, summary, topics isin: str The ISIN of the stock to get themes for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A nested dictionary in the following format: { summary: str topics: [ { topicId: str topicLabel: str topicDescription: str topicPolarity: str newsItems: [ { newsId: str headline: str url: str summary: str source: str publishedAt: str } ] } ] other_news_count: int }
5614def getThemeDetails( 5615 apikey: str, 5616 theme_id: str, 5617 universe: ThemeUniverse, 5618 language: Optional[Union[str, Language]] = None, 5619 proxy: Optional[str] = None, 5620 disable_verify_ssl: bool = False, 5621) -> Dict[str, Any]: 5622 """ 5623 Returns detailed theme info for a given theme ID and universe. Theme ID's 5624 can be fetched from the getAllThemeMetadata endpoint. 5625 Parameters 5626 ---------- 5627 apikey: str 5628 API key provided by Boosted. This key should be protected as a secret. 5629 theme_id: str 5630 UUID representing either a boosted theme or a theme owned with the 5631 account associated with the api key. Theme ID's can be fetched from the 5632 getAllThemeMetadata endpoint. 5633 universe: ThemeUniverse 5634 The universe of stocks to use when showing theme details/impacts. 5635 language: Optional[str | Language] 5636 Will translate AI generated text into the given language. This may be a 5637 language in the Language enum or any language code supported by Google 5638 Translate. 5639 proxy: str 5640 Your organization may require the use of a proxy for access. 5641 The address of a HTTPS proxy in the format of <address>:<port>. 5642 Examples are "123.456.789:123" or "my.proxy.com:123". 5643 Do not prepend with "https://". 5644 disable_verify_ssl: bool 5645 Your networking setup may be behind a firewall which performs SSL 5646 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5647 to point to the location of a custom certificate bundle, or set this 5648 parameter to true to disable SSL verification as a workaround. 5649 Returns 5650 ------- 5651 A nested dictionary in the following format: 5652 { 5653 "theme_name": str, 5654 "theme_summary": str, 5655 "impacts": [ 5656 { 5657 "impact_name": str, 5658 "impact_description": str, 5659 "impact_score": float, 5660 "articles": [ 5661 { 5662 "title": str, 5663 "url": str, 5664 "source": str, 5665 "publish_date": str 5666 } 5667 ], 5668 "impact_stocks": [ 5669 { 5670 "isin": str, 5671 "name": str, 5672 "positive_impact_relation": bool 5673 } 5674 ] 5675 } 5676 ], 5677 "stocks": [ 5678 { 5679 "isin": str, 5680 "name": str, 5681 "positive_theme_relation": bool, 5682 "reason": str, 5683 "theme_stock_impact_score": float 5684 } 5685 ], 5686 "developments": [ 5687 { 5688 "name": str, 5689 "article_count": int, 5690 "date": datetime.date, 5691 "description": str, 5692 "is_major_development": bool, 5693 "sentiment": int, (-1, 0, 1) 5694 "news": [ 5695 { 5696 "headline": str, 5697 "published_at": datetime.datetime, 5698 "source": str, 5699 "url": str, 5700 } 5701 ] 5702 } 5703 ] 5704 } 5705 5706 """ 5707 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5708 return client.get_theme_details(theme_id=theme_id, universe=universe, language=language)
Returns detailed theme info for a given theme ID and universe. Theme ID's can be fetched from the getAllThemeMetadata endpoint.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. theme_id: str UUID representing either a boosted theme or a theme owned with the account associated with the api key. Theme ID's can be fetched from the getAllThemeMetadata endpoint. universe: ThemeUniverse The universe of stocks to use when showing theme details/impacts. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A nested dictionary in the following format: { "theme_name": str, "theme_summary": str, "impacts": [ { "impact_name": str, "impact_description": str, "impact_score": float, "articles": [ { "title": str, "url": str, "source": str, "publish_date": str } ], "impact_stocks": [ { "isin": str, "name": str, "positive_impact_relation": bool } ] } ], "stocks": [ { "isin": str, "name": str, "positive_theme_relation": bool, "reason": str, "theme_stock_impact_score": float } ], "developments": [ { "name": str, "article_count": int, "date": datetime.date, "description": str, "is_major_development": bool, "sentiment": int, (-1, 0, 1) "news": [ { "headline": str, "published_at": datetime.datetime, "source": str, "url": str, } ] } ] }
5711def getAllThemeMetadata( 5712 apikey: str, 5713 language: Optional[Union[str, Language]] = None, 5714 proxy: Optional[str] = None, 5715 disable_verify_ssl: bool = False, 5716) -> List[Dict[str, Any]]: 5717 """ 5718 Returns metadata about all themes owned by the account associated with the 5719 given API key. 5720 Parameters 5721 ---------- 5722 apikey: str 5723 API key provided by Boosted. This key should be protected as a secret. 5724 language: Optional[str | Language] 5725 Will translate AI generated text into the given language. This may be a 5726 language in the Language enum or any language code supported by Google 5727 Translate. 5728 proxy: str 5729 Your organization may require the use of a proxy for access. 5730 The address of a HTTPS proxy in the format of <address>:<port>. 5731 Examples are "123.456.789:123" or "my.proxy.com:123". 5732 Do not prepend with "https://". 5733 disable_verify_ssl: bool 5734 Your networking setup may be behind a firewall which performs SSL 5735 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5736 to point to the location of a custom certificate bundle, or set this 5737 parameter to true to disable SSL verification as a workaround. 5738 Returns 5739 ------- 5740 A list of dictionaries in the following format: 5741 [ 5742 { 5743 "theme_name": str, 5744 "theme_id": str, 5745 "universes": List[str] 5746 } 5747 ] 5748 5749 """ 5750 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5751 return client.get_all_theme_metadata(language=language)
Returns metadata about all themes owned by the account associated with the given API key.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of dictionaries in the following format: [ { "theme_name": str, "theme_id": str, "universes": List[str] } ]
5754def getEarningsImpactingSecurity( 5755 apikey: str, 5756 isin: str, 5757 currency: Optional[str] = None, 5758 country: Optional[str] = None, 5759 language: Optional[Union[str, Language]] = None, 5760 proxy: Optional[str] = None, 5761 disable_verify_ssl: bool = False, 5762) -> List[Dict[str, Any]]: 5763 """ 5764 Returns upcoming earnings releases that could impact the given security. 5765 Parameters 5766 ---------- 5767 apikey: str 5768 API key provided by Boosted. This key should be protected as a secret. 5769 isin: str 5770 The ISIN of the stock to get themes for. 5771 currency: Optional[str] 5772 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5773 "ANY", "p_USA", "CAN" 5774 country: Optional[str] 5775 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5776 language: Optional[str | Language] 5777 Will translate AI generated text into the given language. This may be a 5778 language in the Language enum or any language code supported by Google 5779 Translate. 5780 start_date & end_date: Optional[BoostedDate] 5781 The start and end date to calculate the theme importance. If not provided, the default is 5782 the past 30 days. 5783 proxy: str 5784 Your organization may require the use of a proxy for access. 5785 The address of a HTTPS proxy in the format of <address>:<port>. 5786 Examples are "123.456.789:123" or "my.proxy.com:123". 5787 Do not prepend with "https://". 5788 disable_verify_ssl: bool 5789 Your networking setup may be behind a firewall which performs SSL 5790 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5791 to point to the location of a custom certificate bundle, or set this 5792 parameter to true to disable SSL verification as a workaround. 5793 Returns 5794 ------- 5795 A list of dictionaries in the following format: 5796 [ 5797 { 5798 "event_date": str, 5799 "company_name": str, 5800 "symbol": str, 5801 "isin": str, 5802 "impact_reason": str 5803 } 5804 ] 5805 5806 """ 5807 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5808 return client.get_earnings_impacting_security( 5809 isin=isin, country=country, currency=currency, language=language 5810 )
Returns upcoming earnings releases that could impact the given security.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin: str The ISIN of the stock to get themes for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of dictionaries in the following format: [ { "event_date": str, "company_name": str, "symbol": str, "isin": str, "impact_reason": str } ]
5813def getEarningsInsights( 5814 apikey: str, 5815 isin: str, 5816 currency: Optional[str] = None, 5817 country: Optional[str] = None, 5818 proxy: Optional[str] = None, 5819 disable_verify_ssl: bool = False, 5820) -> Dict[str, Any]: 5821 """ 5822 Returns earnings insights data for a security. This data includes summarized 5823 versions of the two most recent earnings calls, as well as a generated 5824 comparison between them. 5825 Parameters 5826 ---------- 5827 apikey: str 5828 API key provided by Boosted. This key should be protected as a secret. 5829 isin: str 5830 The ISIN of the stock to get earnings data for. 5831 currency: Optional[str] 5832 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5833 "ANY", "p_USA", "CAN" 5834 country: Optional[str] 5835 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5836 proxy: str 5837 Your organization may require the use of a proxy for access. 5838 The address of a HTTPS proxy in the format of <address>:<port>. 5839 Examples are "123.456.789:123" or "my.proxy.com:123". 5840 Do not prepend with "https://". 5841 disable_verify_ssl: bool 5842 Your networking setup may be behind a firewall which performs SSL 5843 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5844 to point to the location of a custom certificate bundle, or set this 5845 parameter to true to disable SSL verification as a workaround. 5846 Returns 5847 ------- 5848 A dictionary in the following format: 5849 { 5850 "earnings_report": 5851 { 5852 "release_date": datetime.date, 5853 "quarter": int, 5854 "year": int, 5855 "details": [ 5856 {"header": str, "detail": str, "sentiment": "str"} 5857 ], 5858 "call_summary": str, 5859 "common_remarks": [ 5860 {"header": str, "detail": str, "sentiment": "str"} 5861 ], 5862 "dropped_remarks": [ 5863 {"header": str, "detail": str, "sentiment": "str"} 5864 ], 5865 "qa_summary": str, 5866 "qa_details": [ 5867 {"header": str, "detail": str, "sentiment": "str"} 5868 ], 5869 }, 5870 "prior_earnings_report": (same as above except dropped_remarks becomes new_remarks), 5871 "report_comparison": [ 5872 {"header": str, "detail": str} 5873 ] 5874 } 5875 """ 5876 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5877 return client.get_earnings_insights_for_stocks(isin=isin, currency=currency, country=country)
Returns earnings insights data for a security. This data includes summarized versions of the two most recent earnings calls, as well as a generated comparison between them.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin: str The ISIN of the stock to get earnings data for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dictionary in the following format: { "earnings_report": { "release_date": datetime.date, "quarter": int, "year": int, "details": [ {"header": str, "detail": str, "sentiment": "str"} ], "call_summary": str, "common_remarks": [ {"header": str, "detail": str, "sentiment": "str"} ], "dropped_remarks": [ {"header": str, "detail": str, "sentiment": "str"} ], "qa_summary": str, "qa_details": [ {"header": str, "detail": str, "sentiment": "str"} ], }, "prior_earnings_report": (same as above except dropped_remarks becomes new_remarks), "report_comparison": [ {"header": str, "detail": str} ] }
5881def getPortfolioInferenceStatus( 5882 apikey: str, 5883 portfolio_id: str, 5884 inference_date: str, 5885 proxy: Optional[str] = None, 5886 disable_verify_ssl: bool = False, 5887) -> Dict[str, Any]: 5888 """ 5889 Returns the live inference status of a portfolio, or the expected finish time if it is 5890 not yet done. 5891 Parameters 5892 ---------- 5893 apikey: str 5894 API key provided by Boosted. This key should be protected as a secret. 5895 portfolio_id: str 5896 The ID of the portfolio. This comes from the URL used to access the portfolio on the screen. 5897 Will be a UUID such as "ffffffff-ffff-ffff-ffff-ffffffffffff" 5898 inference_date: str 5899 YYYY-MM-DD string, such as 2023-09-22 5900 proxy: str 5901 Your organization may require the use of a proxy for access. 5902 The address of a HTTPS proxy in the format of <address>:<port>. 5903 Examples are "123.456.789:123" or "my.proxy.com:123". 5904 Do not prepend with "https://". 5905 disable_verify_ssl: bool 5906 Your networking setup may be behind a firewall which performs SSL 5907 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5908 to point to the location of a custom certificate bundle, or set this 5909 parameter to true to disable SSL verification as a workaround. 5910 Returns 5911 ------- 5912 portfolio_id could be at one of the following stages before completion - 5913 Date Ingestion, Machine Learning 5914 5915 Returns a dictionary in the following format if no stage has 5916 completed for portfolio_id on inference_date: 5917 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": null, "stageDoneAt": null} 5918 5919 Returns a dictionary in one of the following format 5920 if a stage has completed for the portfolio_id on inference_date: 5921 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": "Data Ingestion", 5922 "stageDoneAt": "2024-04-28T11:46:10Z"} 5923 5924 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": "Machine Learning", 5925 "stageDoneAt": "2024-04-28T12:46:10Z"} 5926 5927 5928 Returns a dictionary in the following format if the portfolio_id has completed: 5929 {"expectedFinishTimeUTC": null, "stageDone": "Completed", stageDoneAt: "2024-04-28T12:50:10Z"} 5930 5931 """ 5932 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5933 return client.get_portfolio_inference_status( 5934 portfolio_id=portfolio_id, inference_date=inference_date 5935 )
Returns the live inference status of a portfolio, or the expected finish time if it is not yet done.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str The ID of the portfolio. This comes from the URL used to access the portfolio on the screen. Will be a UUID such as "ffffffff-ffff-ffff-ffff-ffffffffffff" inference_date: str YYYY-MM-DD string, such as 2023-09-22 proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
portfolio_id could be at one of the following stages before completion - Date Ingestion, Machine Learning
Returns a dictionary in the following format if no stage has completed for portfolio_id on inference_date: {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": null, "stageDoneAt": null}
Returns a dictionary in one of the following format if a stage has completed for the portfolio_id on inference_date: {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": "Data Ingestion", "stageDoneAt": "2024-04-28T11:46:10Z"}
{"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "stageDone": "Machine Learning", "stageDoneAt": "2024-04-28T12:46:10Z"}
Returns a dictionary in the following format if the portfolio_id has completed: {"expectedFinishTimeUTC": null, "stageDone": "Completed", stageDoneAt: "2024-04-28T12:50:10Z"}
5938def deletePortfolios( 5939 apikey: str, model_to_portfolios: Dict[str, List[str]], proxy=None, disable_verify_ssl=False 5940): 5941 """ 5942 Deletes B1 portfolios given model and portfolio IDs. 5943 5944 Parameters 5945 ---------- 5946 apikey: str 5947 API key provided by Boosted. This key should be protected as a secret. 5948 model_to_portfolios: Dict[str, List[str]] 5949 Maps model id to list of associated portfolio ids to delete 5950 proxy: str 5951 Your organization may require the use of a proxy for access. 5952 The address of a HTTPS proxy in the format of <address>:<port>. 5953 Examples are "123.456.789:123" or "my.proxy.com:123". 5954 Do not prepend with "https://". 5955 disable_verify_ssl: bool 5956 Your networking setup may be behind a firewall which performs SSL 5957 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5958 to point to the location of a custom certificate bundle, or set this 5959 parameter to true to disable SSL verification as a workaround. 5960 5961 Returns 5962 ------- 5963 None 5964 """ 5965 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5966 client.delete_portfolios(model_to_portfolios)
Deletes B1 portfolios given model and portfolio IDs.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_to_portfolios: Dict[str, List[str]] Maps model id to list of associated portfolio ids to delete proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None