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)
logger =
<Logger boosted.api (WARNING)>
def
inferDependentDataSetSchema(name, df, infer_from_column_names=False):