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 getPortfolioAccuracy( 3568 apikey: str, 3569 model_id: str, 3570 portfolio_id: str, 3571 proxy: Optional[str] = None, 3572 disable_verify_ssl: bool = False, 3573 start_date: Optional[BoostedDate] = None, 3574 end_date: Optional[BoostedDate] = None, 3575) -> dict: 3576 """ 3577 Get the accuracy (hit rate & excess return) information of a given portfolio. 3578 Parameters 3579 ---------- 3580 apikey: str 3581 API key provided by Boosted. This key should be protected as a secret. 3582 model_id: str 3583 Model ID of the portfolio to fetch data for. 3584 portfolio_id: str 3585 ID of the portfolio to fetch data for. 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 start_date: Optional[datetime.date | str] 3597 Start date for portfolio accuracy date range. If this or end_date is 3598 omitted, full history will be returned. 3599 end_date: Optional[datetime.date | str] 3600 End date for portfolio accuracy date range. If this or start_date is 3601 omitted, full history will be returned. 3602 3603 Returns 3604 ------- 3605 accuracy: dict 3606 Dictionary containing accuracy information by Quantile, Decile and Ventile. 3607 """ 3608 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3609 return client.get_portfolio_accuracy( 3610 model_id, portfolio_id, start_date=start_date, end_date=end_date 3611 ) 3612 3613 3614def createWatchlist( 3615 apikey: str, 3616 name: str, 3617 proxy: Optional[str] = None, 3618 disable_verify_ssl: bool = False, 3619) -> str: 3620 """ 3621 Create a watchlist and get back the watchlist_id for it 3622 3623 Parameters 3624 ---------- 3625 apikey: str 3626 API key provided by Boosted. This key should be protected as a secret. 3627 name: str 3628 Name to associate with the watchlist 3629 proxy: str 3630 Your organization may require the use of a proxy for access. 3631 The address of a HTTPS proxy in the format of <address>:<port>. 3632 Examples are "123.456.789:123" or "my.proxy.com:123". 3633 Do not prepend with "https://". 3634 disable_verify_ssl: bool 3635 Your networking setup may be behind a firewall which performs SSL 3636 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3637 to point to the location of a custom certificate bundle, or set this 3638 parameter to true to disable SSL verification as a workaround. 3639 Returns 3640 ------- 3641 watchlist_id: str 3642 UUID to uniquely identify the newly created watchlist 3643 """ 3644 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3645 return client.create_watchlist(name) 3646 3647 3648def createWatchlistFromFile( 3649 apikey: str, 3650 name: str, 3651 filepath: str, 3652 proxy: Optional[str] = None, 3653 disable_verify_ssl: bool = False, 3654) -> str: 3655 """ 3656 Create a watchlist and get back the watchlist_id for it 3657 3658 Parameters 3659 ---------- 3660 apikey: str 3661 API key provided by Boosted. This key should be protected as a secret. 3662 name: str 3663 Name to associate with the watchlist 3664 filepath: str 3665 path to file to upload, 3666 proxy: str 3667 Your organization may require the use of a proxy for access. 3668 The address of a HTTPS proxy in the format of <address>:<port>. 3669 Examples are "123.456.789:123" or "my.proxy.com:123". 3670 Do not prepend with "https://". 3671 disable_verify_ssl: bool 3672 Your networking setup may be behind a firewall which performs SSL 3673 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3674 to point to the location of a custom certificate bundle, or set this 3675 parameter to true to disable SSL verification as a workaround. 3676 Returns 3677 ------- 3678 watchlist_id: str 3679 UUID to uniquely identify the newly created watchlist 3680 """ 3681 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3682 return client.create_watchlist_from_file(name, filepath) 3683 3684 3685def getWatchlists( 3686 apikey: str, 3687 proxy: Optional[str] = None, 3688 disable_verify_ssl: bool = False, 3689) -> List[Dict]: 3690 """ 3691 Get the list of watchlists 3692 3693 Parameters 3694 ---------- 3695 apikey: str 3696 API key provided by Boosted. This key should be protected as a secret. 3697 proxy: str 3698 Your organization may require the use of a proxy for access. 3699 The address of a HTTPS proxy in the format of <address>:<port>. 3700 Examples are "123.456.789:123" or "my.proxy.com:123". 3701 Do not prepend with "https://". 3702 disable_verify_ssl: bool 3703 Your networking setup may be behind a firewall which performs SSL 3704 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3705 to point to the location of a custom certificate bundle, or set this 3706 parameter to true to disable SSL verification as a workaround. 3707 Returns 3708 ------- 3709 watchlists: List[Dict] 3710 List of dictionaries with watchlist_id and name 3711 """ 3712 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3713 return client.get_watchlists() 3714 3715 3716def getWatchlistContents( 3717 apikey: str, 3718 watchlist_id: str, 3719 proxy: Optional[str] = None, 3720 disable_verify_ssl: bool = False, 3721) -> Dict: 3722 """ 3723 Add a list of ISINs to a watchlist 3724 Parameters 3725 ---------- 3726 apikey: str 3727 API key provided by Boosted. This key should be protected as a secret. 3728 watchlist_id: str 3729 The UUID for an existing watchlist that the user has read access to 3730 proxy: str 3731 Your organization may require the use of a proxy for access. 3732 The address of a HTTPS proxy in the format of <address>:<port>. 3733 Examples are "123.456.789:123" or "my.proxy.com:123". 3734 Do not prepend with "https://". 3735 disable_verify_ssl: bool 3736 Your networking setup may be behind a firewall which performs SSL 3737 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3738 to point to the location of a custom certificate bundle, or set this 3739 parameter to true to disable SSL verification as a workaround. 3740 Returns 3741 ------- 3742 Information suitable to recreate the watchlist 3743 Dict { 3744 "watchlist_id": str 3745 "contents": List[Dict] 3746 Keys: 'ISIN' 'TICKER', 'COUNTRY', 'CURRENCY', 'CATEGORY' 3747 } 3748 3749 """ 3750 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3751 return client.get_watchlist_contents(watchlist_id) 3752 3753 3754def getWatchlistContentsAsCsv( 3755 apikey: str, 3756 watchlist_id: str, 3757 filepath: str, 3758 proxy: Optional[str] = None, 3759 disable_verify_ssl: bool = False, 3760) -> None: 3761 """ 3762 Get Watchlist securities in csv format 3763 Parameters 3764 ---------- 3765 apikey: str 3766 API key provided by Boosted. This key should be protected as a secret. 3767 watchlist_id: str 3768 The UUID for an existing watchlist that the user has read access to 3769 filepath: str 3770 Destination for csv file to be written to 3771 proxy: str 3772 Your organization may require the use of a proxy for access. 3773 The address of a HTTPS proxy in the format of <address>:<port>. 3774 Examples are "123.456.789:123" or "my.proxy.com:123". 3775 Do not prepend with "https://". 3776 disable_verify_ssl: bool 3777 Your networking setup may be behind a firewall which performs SSL 3778 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3779 to point to the location of a custom certificate bundle, or set this 3780 parameter to true to disable SSL verification as a workaround. 3781 Returns 3782 ------- 3783 None 3784 """ 3785 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3786 return client.get_watchlist_contents_as_csv(watchlist_id, filepath) 3787 3788 3789def getCoverageInfo( 3790 apikey: str, 3791 watchlist_id: str, 3792 portfolio_group_id: str, 3793 proxy: Optional[str] = None, 3794 disable_verify_ssl: bool = False, 3795) -> pd.DataFrame: 3796 """ 3797 Get Coverage info for a given watchlist and portfolio group 3798 Parameters 3799 ---------- 3800 apikey: str 3801 API key provided by Boosted. This key should be protected as a secret. 3802 watchlist_id: str 3803 The UUID for an existing watchlist that the user has read access to 3804 portfolio_group_id: str 3805 The UUID for an existing portfolio group that the user has read access to 3806 proxy: str 3807 Your organization may require the use of a proxy for access. 3808 The address of a HTTPS proxy in the format of <address>:<port>. 3809 Examples are "123.456.789:123" or "my.proxy.com:123". 3810 Do not prepend with "https://". 3811 disable_verify_ssl: bool 3812 Your networking setup may be behind a firewall which performs SSL 3813 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3814 to point to the location of a custom certificate bundle, or set this 3815 parameter to true to disable SSL verification as a workaround. 3816 Returns 3817 ------- 3818 pd.DataFrame 3819 """ 3820 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3821 return client.get_coverage_info(watchlist_id, portfolio_group_id) 3822 3823 3824def getCoverageCsv( 3825 apikey: str, 3826 watchlist_id: str, 3827 portfolio_group_id: str, 3828 filepath: Optional[str], 3829 proxy: Optional[str] = None, 3830 disable_verify_ssl: bool = False, 3831) -> Optional[str]: 3832 """ 3833 Get Coverage info for a given watchlist and portfolio group 3834 Parameters 3835 ---------- 3836 apikey: str 3837 API key provided by Boosted. This key should be protected as a secret. 3838 watchlist_id: str 3839 The UUID for an existing watchlist that the user has read access to 3840 portfolio_group_id: str 3841 The UUID for an existing portfolio group that the user has read access to 3842 filepath: Optional[str] = None 3843 The location to write csv file to 3844 proxy: str 3845 Your organization may require the use of a proxy for access. 3846 The address of a HTTPS proxy in the format of <address>:<port>. 3847 Examples are "123.456.789:123" or "my.proxy.com:123". 3848 Do not prepend with "https://". 3849 disable_verify_ssl: bool 3850 Your networking setup may be behind a firewall which performs SSL 3851 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3852 to point to the location of a custom certificate bundle, or set this 3853 parameter to true to disable SSL verification as a workaround. 3854 Returns 3855 ------- 3856 None if filepath is provided, else a string with a csv's contents is returned 3857 """ 3858 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3859 return client.get_coverage_csv(watchlist_id, portfolio_group_id, filepath) 3860 3861 3862def addSecuritiesToWatchlist( 3863 apikey: str, 3864 watchlist_id: str, 3865 identifiers: List[str], 3866 identifier_type: Literal["TICKER", "ISIN"], 3867 proxy: Optional[str] = None, 3868 disable_verify_ssl: bool = False, 3869) -> Dict: 3870 """ 3871 Add a list of ISINs to a watchlist 3872 Parameters 3873 ---------- 3874 apikey: str 3875 API key provided by Boosted. This key should be protected as a secret. 3876 watchlist_id: str 3877 The UUID for an existing watchlist that the user has write access to 3878 identifiers: List[str] 3879 The list of identifiers to be added to the watchlist. These identifiers can 3880 be tickers or ISINs. See identifier_type. 3881 identifier_type: Literal["TICKER", "ISIN"] 3882 Specifier for the type of identifier. 3883 proxy: str 3884 Your organization may require the use of a proxy for access. 3885 The address of a HTTPS proxy in the format of <address>:<port>. 3886 Examples are "123.456.789:123" or "my.proxy.com:123". 3887 Do not prepend with "https://". 3888 disable_verify_ssl: bool 3889 Your networking setup may be behind a firewall which performs SSL 3890 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3891 to point to the location of a custom certificate bundle, or set this 3892 parameter to true to disable SSL verification as a workaround. 3893 Returns 3894 ------- 3895 status: Dict #FIXME - im not sure what we want to return here 3896 Information about what was modified to in the watchlist 3897 """ 3898 if identifier_type not in ["TICKER", "ISIN"]: 3899 raise ValueError( 3900 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 3901 ) 3902 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3903 return client.add_securities_to_watchlist(watchlist_id, identifiers, identifier_type) 3904 3905 3906def removeSecuritiesFromWatchlist( 3907 apikey: str, 3908 watchlist_id: str, 3909 identifiers: List[str], 3910 identifier_type: Literal["TICKER", "ISIN"], 3911 proxy: Optional[str] = None, 3912 disable_verify_ssl: bool = False, 3913) -> Dict: 3914 """ 3915 Add a list of ISINs to a watchlist 3916 Parameters 3917 ---------- 3918 apikey: str 3919 API key provided by Boosted. This key should be protected as a secret. 3920 watchlist_id: str 3921 The UUID for an existing watchlist that the user has write access to 3922 identifiers: List[str] 3923 The list of identifiers to be added to the watchlist. These identifiers can 3924 be tickers or ISINs. See identifier_type. 3925 identifier_type: Literal["TICKER", "ISIN"] 3926 Specifier for the type of identifier. 3927 proxy: str 3928 Your organization may require the use of a proxy for access. 3929 The address of a HTTPS proxy in the format of <address>:<port>. 3930 Examples are "123.456.789:123" or "my.proxy.com:123". 3931 Do not prepend with "https://". 3932 disable_verify_ssl: bool 3933 Your networking setup may be behind a firewall which performs SSL 3934 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3935 to point to the location of a custom certificate bundle, or set this 3936 parameter to true to disable SSL verification as a workaround. 3937 Returns 3938 ------- 3939 status: Dict #FIXME - im not sure what we want to return here 3940 Information about what was modified to in the watchlist 3941 """ 3942 if identifier_type not in ["TICKER", "ISIN"]: 3943 raise ValueError( 3944 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 3945 ) 3946 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3947 return client.remove_securities_from_watchlist(watchlist_id, identifiers, identifier_type) 3948 3949 3950def setPortfolioGroupForWatchlist( 3951 apikey: str, 3952 portfolio_group_id: str, 3953 watchlist_id: str, 3954 proxy: Optional[str] = None, 3955 disable_verify_ssl: bool = False, 3956) -> Dict: 3957 """ 3958 Set portfolio group for watchlist. 3959 3960 Parameters 3961 ---------- 3962 apikey: str 3963 API key provided by Boosted. This key should be protected as a secret. 3964 portfolio_group_id: str, 3965 UUID str identifying a portfolio group 3966 watchlist_id: str, 3967 UUID str identifying a watchlist 3968 proxy: str 3969 Your organization may require the use of a proxy for access. 3970 The address of a HTTPS proxy in the format of <address>:<port>. 3971 Examples are "123.456.789:123" or "my.proxy.com:123". 3972 Do not prepend with "https://". 3973 disable_verify_ssl: bool 3974 Your networking setup may be behind a firewall which performs SSL 3975 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3976 to point to the location of a custom certificate bundle, or set this 3977 parameter to true to disable SSL verification as a workaround. 3978 Returns 3979 ------- 3980 Dict: with a list of all portfolio groups for the user 3981 """ 3982 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3983 return client.set_portfolio_group_for_watchlist(portfolio_group_id, watchlist_id) 3984 3985 3986def setStickyPortfolioGroup( 3987 apikey: str, 3988 portfolio_group_id: str, 3989 proxy: Optional[str] = None, 3990 disable_verify_ssl: bool = False, 3991) -> Dict: 3992 """ 3993 Set sticky portfolio group for the user. 3994 3995 Parameters 3996 ---------- 3997 apikey: str 3998 API key provided by Boosted. This key should be protected as a secret. 3999 portfolio_group_id: str, 4000 UUID str identifying a portfolio group 4001 proxy: str 4002 Your organization may require the use of a proxy for access. 4003 The address of a HTTPS proxy in the format of <address>:<port>. 4004 Examples are "123.456.789:123" or "my.proxy.com:123". 4005 Do not prepend with "https://". 4006 disable_verify_ssl: bool 4007 Your networking setup may be behind a firewall which performs SSL 4008 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4009 to point to the location of a custom certificate bundle, or set this 4010 parameter to true to disable SSL verification as a workaround. 4011 Returns 4012 ------- 4013 Dict: with a list of all portfolio groups for the user 4014 """ 4015 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4016 return client.set_sticky_portfolio_group(portfolio_group_id) 4017 4018 4019def getStickyPortfolioGroup( 4020 apikey: str, 4021 proxy: Optional[str] = None, 4022 disable_verify_ssl: bool = False, 4023) -> Dict: 4024 """ 4025 Get sticky portfolio group for the user. 4026 4027 Parameters 4028 ---------- 4029 apikey: str 4030 API key provided by Boosted. This key should be protected as a secret. 4031 proxy: str 4032 Your organization may require the use of a proxy for access. 4033 The address of a HTTPS proxy in the format of <address>:<port>. 4034 Examples are "123.456.789:123" or "my.proxy.com:123". 4035 Do not prepend with "https://". 4036 disable_verify_ssl: bool 4037 Your networking setup may be behind a firewall which performs SSL 4038 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4039 to point to the location of a custom certificate bundle, or set this 4040 parameter to true to disable SSL verification as a workaround. 4041 Returns 4042 ------- 4043 Dict { 4044 group_id: str 4045 group_name: str 4046 portfolios: List[PortfolioInGroup(Dict)] 4047 PortfolioInGroup(Dict): 4048 portfolio_id: str 4049 rank_in_group: Optional[int] = None 4050 portfolio_name: Optional[str] = None 4051 } 4052 """ 4053 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4054 return client.get_sticky_portfolio_group() 4055 4056 4057def getPortfolioGroup( 4058 apikey: str, 4059 portfolio_group_id: str, 4060 proxy: Optional[str] = None, 4061 disable_verify_ssl: bool = False, 4062) -> Dict: 4063 """ 4064 Get a single portfolio group. 4065 4066 Parameters 4067 ---------- 4068 apikey: str 4069 API key provided by Boosted. This key should be protected as a secret. 4070 portfolio_group_id: str, 4071 UUID str identifying a portfolio group 4072 proxy: str 4073 Your organization may require the use of a proxy for access. 4074 The address of a HTTPS proxy in the format of <address>:<port>. 4075 Examples are "123.456.789:123" or "my.proxy.com:123". 4076 Do not prepend with "https://". 4077 disable_verify_ssl: bool 4078 Your networking setup may be behind a firewall which performs SSL 4079 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4080 to point to the location of a custom certificate bundle, or set this 4081 parameter to true to disable SSL verification as a workaround. 4082 Returns 4083 ------- 4084 PortfolioGroup: Dict: { 4085 group_id: str 4086 group_name: str 4087 portfolios: List[PortfolioInGroup] 4088 } 4089 where PortfolioInGroup is defined as = Dict { 4090 portfolio_id: str 4091 portfolio_name: str 4092 rank_in_group: Optional[int] 4093 } 4094 """ 4095 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4096 return client.get_portfolio_group(portfolio_group_id) 4097 4098 4099def getPortfolioGroups( 4100 apikey: str, 4101 proxy: Optional[str] = None, 4102 disable_verify_ssl: bool = False, 4103) -> Dict: 4104 """ 4105 Get a list of all portfolio groups for the user 4106 4107 Parameters 4108 ---------- 4109 apikey: str 4110 API key provided by Boosted. This key should be protected as a secret. 4111 proxy: str 4112 Your organization may require the use of a proxy for access. 4113 The address of a HTTPS proxy in the format of <address>:<port>. 4114 Examples are "123.456.789:123" or "my.proxy.com:123". 4115 Do not prepend with "https://". 4116 disable_verify_ssl: bool 4117 Your networking setup may be behind a firewall which performs SSL 4118 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4119 to point to the location of a custom certificate bundle, or set this 4120 parameter to true to disable SSL verification as a workaround. 4121 Returns 4122 ------- 4123 Dict: with a list of all portfolio groups for the user 4124 """ 4125 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4126 return client.get_portfolio_groups() 4127 4128 4129def createPortfolioGroup( 4130 apikey: str, 4131 group_name: str, 4132 portfolios: Optional[List[Dict]] = None, 4133 proxy: Optional[str] = None, 4134 disable_verify_ssl: bool = False, 4135) -> Dict: 4136 """ 4137 Create a new portfolio group 4138 4139 Parameters 4140 ---------- 4141 apikey: str 4142 API key provided by Boosted. This key should be protected as a secret. 4143 4144 group_name: str 4145 name of the new group 4146 4147 portfolios: List of Dict [: 4148 4149 portfolio_id: str 4150 rank_in_group: Optional[int] = None 4151 ] 4152 4153 proxy: str 4154 Your organization may require the use of a proxy for access. 4155 The address of a HTTPS proxy in the format of <address>:<port>. 4156 Examples are "123.456.789:123" or "my.proxy.com:123". 4157 Do not prepend with "https://". 4158 disable_verify_ssl: bool 4159 Your networking setup may be behind a firewall which performs SSL 4160 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4161 to point to the location of a custom certificate bundle, or set this 4162 parameter to true to disable SSL verification as a workaround. 4163 4164 4165 Returns: 4166 ---------- 4167 4168 Dict: { 4169 group_id: str 4170 UUID identifier for the portfolio group 4171 4172 created: int 4173 num groups created, 1 == success 4174 4175 added: int 4176 num portfolios added to the group, should match the length of 'portfolios' argument 4177 } 4178 4179 """ 4180 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4181 return client.create_portfolio_group(group_name, portfolios) 4182 4183 4184def renamePortfolioGroup( 4185 apikey: str, 4186 group_id: str, 4187 group_name: str, 4188 proxy: Optional[str] = None, 4189 disable_verify_ssl: bool = False, 4190) -> Dict: 4191 """ 4192 Rename a portfolio group 4193 4194 Parameters 4195 ---------- 4196 apikey: str 4197 API key provided by Boosted. This key should be protected as a secret. 4198 4199 group_id: str, 4200 UUID str identifying a portfolio group 4201 4202 group_name: str, 4203 The new name for the porfolio 4204 4205 proxy: str 4206 Your organization may require the use of a proxy for access. 4207 The address of a HTTPS proxy in the format of <address>:<port>. 4208 Examples are "123.456.789:123" or "my.proxy.com:123". 4209 Do not prepend with "https://". 4210 disable_verify_ssl: bool 4211 Your networking setup may be behind a firewall which performs SSL 4212 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4213 to point to the location of a custom certificate bundle, or set this 4214 parameter to true to disable SSL verification as a workaround. 4215 4216 Returns: 4217 ------- 4218 Dict { 4219 changed: int - 1 == success 4220 } 4221 """ 4222 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4223 return client.rename_portfolio_group(group_id, group_name) 4224 4225 4226def addToPortfolioGroup( 4227 apikey: str, 4228 group_id: str, 4229 portfolios: List[Dict], 4230 proxy: Optional[str] = None, 4231 disable_verify_ssl: bool = False, 4232) -> Dict: 4233 """ 4234 Add portfolios to a group 4235 4236 Parameters 4237 ---------- 4238 apikey: str 4239 API key provided by Boosted. This key should be protected as a secret. 4240 4241 group_id: str, 4242 UUID str identifying a portfolio group 4243 4244 portfolios: List of Dict [: 4245 portfolio_id: str 4246 rank_in_group: Optional[int] = None 4247 ] 4248 4249 4250 proxy: str 4251 Your organization may require the use of a proxy for access. 4252 The address of a HTTPS proxy in the format of <address>:<port>. 4253 Examples are "123.456.789:123" or "my.proxy.com:123". 4254 Do not prepend with "https://". 4255 disable_verify_ssl: bool 4256 Your networking setup may be behind a firewall which performs SSL 4257 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4258 to point to the location of a custom certificate bundle, or set this 4259 parameter to true to disable SSL verification as a workaround. 4260 4261 4262 Returns: 4263 ------- 4264 Dict { 4265 added: int 4266 number of successful changes 4267 } 4268 """ 4269 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4270 return client.add_to_portfolio_group(group_id, portfolios) 4271 4272 4273def removeFromPortfolioGroup( 4274 apikey: str, 4275 group_id: str, 4276 portfolios: List[str], 4277 proxy: Optional[str] = None, 4278 disable_verify_ssl: bool = False, 4279) -> Dict: 4280 """ 4281 Remove portfolios from a group 4282 4283 Parameters 4284 ---------- 4285 apikey: str 4286 API key provided by Boosted. This key should be protected as a secret. 4287 4288 group_id: str, 4289 UUID str identifying a portfolio group 4290 4291 portfolios: List of str 4292 4293 4294 proxy: str 4295 Your organization may require the use of a proxy for access. 4296 The address of a HTTPS proxy in the format of <address>:<port>. 4297 Examples are "123.456.789:123" or "my.proxy.com:123". 4298 Do not prepend with "https://". 4299 disable_verify_ssl: bool 4300 Your networking setup may be behind a firewall which performs SSL 4301 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4302 to point to the location of a custom certificate bundle, or set this 4303 parameter to true to disable SSL verification as a workaround. 4304 4305 4306 Returns: 4307 ------- 4308 Dict { 4309 removed: int 4310 number of successful changes 4311 } 4312 """ 4313 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4314 return client.remove_from_portfolio_group(group_id, portfolios) 4315 4316 4317def deletePortfolioGroup( 4318 apikey: str, 4319 group_id: str, 4320 proxy: Optional[str] = None, 4321 disable_verify_ssl: bool = False, 4322) -> Dict: 4323 """ 4324 Delete a portfolio group 4325 4326 Parameters 4327 ---------- 4328 4329 apikey: str 4330 API key provided by Boosted. This key should be protected as a secret. 4331 4332 group_id: str, 4333 UUID str identifying a portfolio group 4334 4335 proxy: str 4336 Your organization may require the use of a proxy for access. 4337 The address of a HTTPS proxy in the format of <address>:<port>. 4338 Examples are "123.456.789:123" or "my.proxy.com:123". 4339 Do not prepend with "https://". 4340 disable_verify_ssl: bool 4341 Your networking setup may be behind a firewall which performs SSL 4342 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4343 to point to the location of a custom certificate bundle, or set this 4344 parameter to true to disable SSL verification as a workaround. 4345 4346 Returns 4347 ------- 4348 4349 Dict { 4350 removed_groups: int 4351 number of successful changes 4352 4353 removed_portfolios: int 4354 number of successful changes 4355 } 4356 4357 """ 4358 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4359 return client.delete_portfolio_group(group_id) 4360 4361 4362def getRiskGroups( 4363 apikey: str, 4364 model_id: str, 4365 portfolio_id: str, 4366 date: BoostedDate = datetime.date.today(), 4367 proxy: Optional[str] = None, 4368 disable_verify_ssl: bool = False, 4369 use_v2: bool = False, 4370) -> List[Dict[str, Any]]: 4371 """ 4372 Given a model and portfolio, returns the calculated semantic risk groups. 4373 4374 Parameters 4375 ---------- 4376 apikey: str 4377 API key provided by Boosted. This key should be protected as a secret. 4378 model_id: str 4379 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4380 button next to your model's name in the Model Summary Page in Boosted 4381 Insights. 4382 portfolio_id: str 4383 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4384 date: datetime.date | str 4385 Date for which to fetch data. Defaults to "today". 4386 use_v2: bool 4387 Whether to use the "V2" version of risk factors data. 4388 proxy: str 4389 Your organization may require the use of a proxy for access. 4390 The address of a HTTPS proxy in the format of <address>:<port>. 4391 Examples are "123.456.789:123" or "my.proxy.com:123". 4392 Do not prepend with "https://". 4393 disable_verify_ssl: bool 4394 Your networking setup may be behind a firewall which performs SSL 4395 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4396 to point to the location of a custom certificate bundle, or set this 4397 parameter to true to disable SSL verification as a workaround. 4398 4399 Returns 4400 ------- 4401 A list of dictionaries. Each dictionary has the following keys: 4402 machine: int 4403 E.g. 1 for "machine_1", 2 for "machine_2", etc. 4404 risk_group_a: List[str] 4405 List of stock descriptors risk group a (e.g. Cruises, Airlines, etc.) 4406 risk_group_b: List[str] 4407 List of stock descriptors risk group b (e.g. Cruises, Airlines, etc.) 4408 volatility_explained: float 4409 Decimal between 0.0 and 1.0 that represents the percent of stock 4410 universe volatility explained by these groups. 4411 """ 4412 date = convert_date(date) 4413 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4414 return client.get_risk_groups(model_id, portfolio_id, date, use_v2) 4415 4416 4417def getRiskFactorsDiscoveredDescriptors( 4418 apikey: str, 4419 model_id: str, 4420 portfolio_id: str, 4421 date: BoostedDate = datetime.date.today(), 4422 proxy: Optional[str] = None, 4423 disable_verify_ssl: bool = False, 4424 use_v2: bool = False, 4425) -> pd.DataFrame: 4426 """ 4427 Given a model and portfolio, returns the calculated semantic risk discovered 4428 descriptors. 4429 4430 Parameters 4431 ---------- 4432 apikey: str 4433 API key provided by Boosted. This key should be protected as a secret. 4434 model_id: str 4435 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4436 button next to your model's name in the Model Summary Page in Boosted 4437 Insights. 4438 portfolio_id: str 4439 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4440 date: datetime.date | str 4441 Date for which to fetch data. Defaults to "today". 4442 use_v2: bool 4443 Whether to use the "V2" version of risk factors data. 4444 proxy: str 4445 Your organization may require the use of a proxy for access. 4446 The address of a HTTPS proxy in the format of <address>:<port>. 4447 Examples are "123.456.789:123" or "my.proxy.com:123". 4448 Do not prepend with "https://". 4449 disable_verify_ssl: bool 4450 Your networking setup may be behind a firewall which performs SSL 4451 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4452 to point to the location of a custom certificate bundle, or set this 4453 parameter to true to disable SSL verification as a workaround. 4454 4455 Returns 4456 ------- 4457 A dataframe with the following columns: 4458 4459 level: int 4460 An integer indicating the depth/level of that row (0 for sectors, 1 for 4461 securities). 4462 identifier: str 4463 Sector/security identifier. 4464 stock_count: int 4465 Total number of stocks in the sector/industry. For security rows, will 4466 be 1. 4467 volatility: float 4468 exposure: float 4469 rating: float 4470 rating_delta: float 4471 """ 4472 date = convert_date(date) 4473 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4474 return client.get_risk_factors_discovered_descriptors(model_id, portfolio_id, date, use_v2) 4475 4476 4477def getRiskFactorsSectors( 4478 apikey: str, 4479 model_id: str, 4480 portfolio_id: str, 4481 date: BoostedDate = datetime.date.today(), 4482 proxy: Optional[str] = None, 4483 disable_verify_ssl: bool = False, 4484 use_v2: bool = False, 4485) -> pd.DataFrame: 4486 """ 4487 Given a model and portfolio, returns the calculated semantic risk sectors. 4488 4489 Parameters 4490 ---------- 4491 apikey: str 4492 API key provided by Boosted. This key should be protected as a secret. 4493 model_id: str 4494 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4495 button next to your model's name in the Model Summary Page in Boosted 4496 Insights. 4497 portfolio_id: str 4498 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4499 date: datetime.date | str 4500 Date for which to fetch data. Defaults to "today". 4501 use_v2: bool 4502 Whether to use the "V2" version of risk factors data. 4503 proxy: str 4504 Your organization may require the use of a proxy for access. 4505 The address of a HTTPS proxy in the format of <address>:<port>. 4506 Examples are "123.456.789:123" or "my.proxy.com:123". 4507 Do not prepend with "https://". 4508 disable_verify_ssl: bool 4509 Your networking setup may be behind a firewall which performs SSL 4510 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4511 to point to the location of a custom certificate bundle, or set this 4512 parameter to true to disable SSL verification as a workaround. 4513 4514 Returns 4515 ------- 4516 A dataframe with the following columns: 4517 4518 level: int 4519 An integer indicating the depth/level of that row (0 for sectors, 1 for 4520 industry groups, 2 for industries). 4521 identifier: str 4522 Sector/Industry group/Industry identifier. 4523 stock_count: int 4524 Total number of stocks in the sector/industry. 4525 volatility: float 4526 exposure: float 4527 rating: float 4528 rating_delta: float 4529 """ 4530 date = convert_date(date) 4531 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4532 return client.get_risk_factors_sectors(model_id, portfolio_id, date, use_v2) 4533 4534 4535def downloadCompletePortfolioData( 4536 apikey: str, 4537 model_id: str, 4538 portfolio_id: str, 4539 download_filepath: Optional[str] = None, 4540 proxy: Optional[str] = None, 4541 disable_verify_ssl: bool = False, 4542): 4543 """ 4544 Given a model and portfolio, downloads the complete portfolio data as an 4545 excel file to the specified download path. 4546 4547 Parameters 4548 ---------- 4549 apikey: str 4550 API key provided by Boosted. This key should be protected as a secret. 4551 model_id: str 4552 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4553 button next to your model's name in the Model Summary Page in Boosted 4554 Insights. 4555 portfolio_id: str 4556 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4557 download_filepath: Optional[str] 4558 File path to download model data file to. If not present, will default 4559 to a file named after the model_id in the current directory. 4560 proxy: str 4561 Your organization may require the use of a proxy for access. 4562 The address of a HTTPS proxy in the format of <address>:<port>. 4563 Examples are "123.456.789:123" or "my.proxy.com:123". 4564 Do not prepend with "https://". 4565 disable_verify_ssl: bool 4566 Your networking setup may be behind a firewall which performs SSL 4567 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4568 to point to the location of a custom certificate bundle, or set this 4569 parameter to true to disable SSL verification as a workaround. 4570 """ 4571 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4572 if download_filepath is None: 4573 download_filepath = f"{model_id}.xlsx" 4574 client.download_complete_portfolio_data(model_id, portfolio_id, download_filepath) 4575 4576 4577def diffHedgeExperimentPortfolioData( 4578 apikey: str, 4579 experiment_id: str, 4580 comparison_portfolios: List[str], 4581 categories: Optional[List[str]] = None, 4582 proxy: Optional[str] = None, 4583 disable_verify_ssl: bool = False, 4584) -> Dict: 4585 """ 4586 Differences portfolios, returning data relative to the baseline. 4587 4588 This function supports differencing multiple portfolios against the 4589 baseline, such that diff_i = cmp_pf_i - baseline. Differences are 4590 calculated element-wise on a per-category basis. 4591 4592 Currently, this function only works for hedge experiment portfolios. 4593 4594 Parameters 4595 ---------- 4596 apikey: str 4597 API key provided by Boosted. This key should be protected as a secret. 4598 experiment_id: str 4599 Hedge experiment id 4600 comparison_portfolios: List[str] 4601 List of portfolios to be diffed against the current baseline. 4602 categories: List[str] 4603 Specifier of what data to difference. Passing a smaller, desired 4604 subset can improve performance. Options include: 4605 ["performanceGrid", "performance", "factors", "volatility"] 4606 proxy: str 4607 Your organization may require the use of a proxy for access. 4608 The address of a HTTPS proxy in the format of <address>:<port>. 4609 Examples are "123.456.789:123" or "my.proxy.com:123". 4610 Do not prepend with "https://". 4611 disable_verify_ssl: bool 4612 Your networking setup may be behind a firewall which performs SSL 4613 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4614 to point to the location of a custom certificate bundle, or set this 4615 parameter to true to disable SSL verification as a workaround. 4616 4617 Returns 4618 ------- 4619 Dictionary: 4620 { 4621 "factors": Optional[pd.DataFrame], 4622 "volatility":Optional[pd.DataFrame], 4623 "performance": Optional[pd.DataFrame], 4624 "performanceGrid": Optional[pd.DataFrame] 4625 } 4626 """ 4627 4628 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4629 DIFF_CATEGORIES = ["performance", "performanceGrid", "volatility", "factors"] 4630 if categories is None: 4631 categories = DIFF_CATEGORIES 4632 else: 4633 for cat in categories: 4634 if cat not in DIFF_CATEGORIES: 4635 raise ValueError(f"Unexpected category {cat}") 4636 diff = client.diff_hedge_experiment_portfolio_data( 4637 experiment_id, comparison_portfolios, categories 4638 ) 4639 return diff 4640 4641 4642def getSignalStrength( 4643 apikey: str, 4644 model_id: str, 4645 portfolio_id: str, 4646 proxy: Optional[str] = None, 4647 disable_verify_ssl: bool = False, 4648) -> pd.DataFrame: 4649 """ 4650 Retrieves portfolio signals data and returns as a pandas dataframe. 4651 4652 Parameters 4653 ---------- 4654 apikey: str 4655 API key provided by Boosted. This key should be protected as a secret. 4656 model_id: str 4657 UUID of a Boosted model. 4658 portfolio_id: str 4659 UUID of a Boosted portfolio in the given model. 4660 proxy: str 4661 Your organization may require the use of a proxy for access. 4662 The address of a HTTPS proxy in the format of <address>:<port>. 4663 Examples are "123.456.789:123" or "my.proxy.com:123". 4664 Do not prepend with "https://". 4665 disable_verify_ssl: bool 4666 Your networking setup may be behind a firewall which performs SSL 4667 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4668 to point to the location of a custom certificate bundle, or set this 4669 parameter to true to disable SSL verification as a workaround. 4670 4671 Returns 4672 ------- 4673 Pandas Dataframe indexed by date with columns: 4674 5D, 10D, 21D, 63D, 126D, 189D, 252D, 315D, 378D, 441D, 504D, TimeHorizon 4675 """ 4676 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4677 return client.get_signal_strength(model_id, portfolio_id) 4678 4679 4680def getRollingSignalStrength( 4681 apikey: str, 4682 model_id: str, 4683 portfolio_id: str, 4684 proxy: Optional[str] = None, 4685 disable_verify_ssl: bool = False, 4686): 4687 """ 4688 Retrieves portfolio rolling signals data and returns as a pandas dataframe. 4689 4690 Parameters 4691 ---------- 4692 apikey: str 4693 API key provided by Boosted. This key should be protected as a secret. 4694 model_id: str 4695 UUID of a Boosted model. 4696 portfolio_id: str 4697 UUID of a Boosted portfolio in the given model. 4698 proxy: str 4699 Your organization may require the use of a proxy for access. 4700 The address of a HTTPS proxy in the format of <address>:<port>. 4701 Examples are "123.456.789:123" or "my.proxy.com:123". 4702 Do not prepend with "https://". 4703 disable_verify_ssl: bool 4704 Your networking setup may be behind a firewall which performs SSL 4705 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4706 to point to the location of a custom certificate bundle, or set this 4707 parameter to true to disable SSL verification as a workaround. 4708 4709 Returns 4710 ------- 4711 Pandas Dataframe indexed by date with columns: 4712 Avg5D 4713 Avg10D 4714 Avg21D 4715 Avg63D 4716 Avg126D 4717 Avg189D 4718 Avg252D 4719 Avg315D 4720 Avg378D 4721 Avg441D 4722 Avg504D 4723 Avgtime Horizon 4724 """ 4725 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4726 return client.get_rolling_signal_strength(model_id, portfolio_id) 4727 4728 4729def getPortfolioFactorAttribution( 4730 apikey: str, 4731 portfolio_id: str, 4732 start_date: Optional[BoostedDate] = None, 4733 end_date: Optional[BoostedDate] = None, 4734 proxy: Optional[str] = None, 4735 disable_verify_ssl: bool = False, 4736): 4737 """Get factor attribution for a portfolio. 4738 Factor attribution is the methodology of using a stock or strategy’s 4739 factor exposure to explain its risk and reward. 4740 4741 Patameters 4742 ---------- 4743 apikey: str : 4744 API key provided by Boosted. This key should be protected as a secret. 4745 portfolio_id: str 4746 UUID of a Boosted portfolio in the given model. 4747 start_date: datetime.date | str 4748 Starting date for which trades should be fetched. 4749 Default to the first date of the portfolio. 4750 end_date: datetime.date | str 4751 Ending date for which trades should be fetched. 4752 Default to the latest date of the portfolio. 4753 proxy: str 4754 Your organization may require the use of a proxy for access. 4755 The address of a HTTPS proxy in the format of <address>:<port>. 4756 Examples are "123.456.789:123" or "my.proxy.com:123". 4757 Do not prepend with "https://". 4758 disable_verify_ssl: bool 4759 Your networking setup may be behind a firewall which performs SSL 4760 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4761 to point to the location of a custom certificate bundle, or set this 4762 parameter to true to disable SSL verification as a workaround. 4763 4764 Returns 4765 ------- 4766 A Pandas Dataframe indexed by date with each factor attribution per column. 4767 The <factor attribution>_return columns are percentages. 4768 For example, 0.05 of `volatility_return` means the return for volatility is 0.05%. 4769 """ 4770 client = BoostedClient(api_key=apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4771 return client.get_portfolio_factor_attribution( 4772 portfolio_id=portfolio_id, 4773 start_date=start_date, 4774 end_date=end_date, 4775 ) 4776 4777 4778def getPortfolioQuantiles( 4779 apikey: str, 4780 model_id: str, 4781 portfolio_id: str, 4782 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4783 proxy: Optional[str] = None, 4784 disable_verify_ssl: bool = False, 4785): 4786 """ 4787 Get quantile data for a portfolio. 4788 4789 Parameters 4790 ---------- 4791 apikey: str 4792 API key provided by Boosted. This key should be protected as a secret. 4793 model_id: str 4794 UUID of a Boosted model. 4795 portfolio_id: str 4796 UUID of a Boosted portfolio in the given model. 4797 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4798 Whether the column names are ISIN's or tickers in the output dataframe. 4799 proxy: str 4800 Your organization may require the use of a proxy for access. 4801 The address of a HTTPS proxy in the format of <address>:<port>. 4802 Examples are "123.456.789:123" or "my.proxy.com:123". 4803 Do not prepend with "https://". 4804 disable_verify_ssl: bool 4805 Your networking setup may be behind a firewall which performs SSL 4806 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4807 to point to the location of a custom certificate bundle, or set this 4808 parameter to true to disable SSL verification as a workaround. 4809 4810 Returns 4811 ------- 4812 Pandas Dataframe indexed by date with each one security per column. 4813 """ 4814 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4815 return client.get_portfolio_quantiles( 4816 model_id=model_id, 4817 portfolio_id=portfolio_id, 4818 id_type=id_type, 4819 ) 4820 4821 4822def getSimilarStocks( 4823 apikey: str, 4824 model_id: str, 4825 portfolio_id: str, 4826 identifiers: List[str], 4827 date: BoostedDate, 4828 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4829 proxy: Optional[str] = None, 4830 disable_verify_ssl: bool = False, 4831 preferred_country: Optional[str] = None, 4832 preferred_currency: Optional[str] = None, 4833) -> pd.DataFrame: 4834 """ 4835 Get the stock similarity data for a basket of stocks. 4836 4837 Parameters 4838 ---------- 4839 apikey: str 4840 API key provided by Boosted. This key should be protected as a secret. 4841 model_id: str 4842 UUID of a Boosted model. 4843 portfolio_id: str 4844 UUID of a Boosted portfolio in the given model. 4845 identifiers: List[str] 4846 List of identifiers that represent the input basket of stocks, can be 4847 either ISIN's or Tickers. 4848 date: Optional[datetime.date | str] 4849 Date for which similarity data should be fetched. 4850 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4851 Should be set to whatever identifier type is input. Defaults to TICKER. 4852 preferred_country: str 4853 The preferred country for the identifier list, to resolve 4854 abiguities. Should be a 3 character iso code. By default, will try to 4855 figure out the best match. 4856 preferred_currency: str 4857 The preferred currency for the identifier list, to resolve 4858 abiguities. Should be a 3 character iso code. By default, will try to 4859 figure out the best match. 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 Pandas Dataframe indexed by identifier with a row for every security in the 4874 portfolio (except for those in the input basket). DataFrame will contain 4875 columns: 4876 - overallSimilarityScore: float 4877 - priceSimilarityScore: float 4878 - factorSimilarityScore: float 4879 - correlation: float 4880 """ 4881 4882 if identifier_type not in ["TICKER", "ISIN"]: 4883 raise ValueError( 4884 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4885 ) 4886 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4887 return client.get_similar_stocks( 4888 model_id=model_id, 4889 portfolio_id=portfolio_id, 4890 symbol_list=identifiers, 4891 date=date, 4892 identifier_type=identifier_type, 4893 preferred_country=preferred_country, 4894 preferred_currency=preferred_currency, 4895 ) 4896 4897 4898def getPortfolioTrades( 4899 apikey: str, 4900 model_id: str, 4901 portfolio_id: str, 4902 start_date: Optional[BoostedDate] = None, 4903 end_date: Optional[BoostedDate] = None, 4904 proxy: Optional[str] = None, 4905 disable_verify_ssl: bool = False, 4906) -> pd.DataFrame: 4907 """ 4908 Get the list of trades for a portfolio. NOTE: The max date range is 7 years, 4909 any larger will return an error. 4910 4911 Parameters 4912 ---------- 4913 apikey: str 4914 API key provided by Boosted. This key should be protected as a secret. 4915 model_id: str 4916 UUID of a Boosted model. 4917 portfolio_id: str 4918 UUID of a Boosted portfolio in the given model. 4919 start_date: Optional[datetime.date | str] 4920 Starting date for which trades should be fetched. 4921 end_date: Optional[datetime.date | str] 4922 Ending date for which trades should be fetched. 4923 proxy: str 4924 Your organization may require the use of a proxy for access. 4925 The address of a HTTPS proxy in the format of <address>:<port>. 4926 Examples are "123.456.789:123" or "my.proxy.com:123". 4927 Do not prepend with "https://". 4928 disable_verify_ssl: bool 4929 Your networking setup may be behind a firewall which performs SSL 4930 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4931 to point to the location of a custom certificate bundle, or set this 4932 parameter to true to disable SSL verification as a workaround. 4933 4934 Returns 4935 ------- 4936 Pandas Dataframe, each row containing data for a security + date. 4937 Columns are: 4938 - isin: str 4939 - ticker: str 4940 - date: datetime.date 4941 - price: float 4942 - shares_owned: float 4943 - shares_traded: float 4944 """ 4945 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4946 return client.get_portfolio_trades( 4947 model_id=model_id, 4948 portfolio_id=portfolio_id, 4949 start_date=start_date, 4950 end_date=end_date, 4951 ) 4952 4953 4954def getIdeas( 4955 apikey: str, 4956 model_id: str, 4957 portfolio_id: str, 4958 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 4959 delta_horizon: Literal["1M", "3M", "6M", "9M", "1Y"] = "1M", 4960 proxy: Optional[str] = None, 4961 disable_verify_ssl: bool = False, 4962) -> pd.DataFrame: 4963 """ 4964 Given a model ID, portfolio ID, and a time horizon, return a dataframe of 4965 stock ideas. 4966 4967 Parameters 4968 ---------- 4969 apikey: str 4970 API key provided by Boosted. This key should be protected as a secret. 4971 model_id: str 4972 UUID of a Boosted model. 4973 portfolio_id: str 4974 UUID of a Boosted portfolio in the given model. 4975 investment_horizon: str 4976 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 4977 delta_horizon: str 4978 Time period over which to compute deltas. Can be "1M", "3M", "6M", "9M", "1Y". 4979 proxy: str 4980 Your organization may require the use of a proxy for access. 4981 The address of a HTTPS proxy in the format of <address>:<port>. 4982 Examples are "123.456.789:123" or "my.proxy.com:123". 4983 Do not prepend with "https://". 4984 disable_verify_ssl: bool 4985 Your networking setup may be behind a firewall which performs SSL 4986 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4987 to point to the location of a custom certificate bundle, or set this 4988 parameter to true to disable SSL verification as a workaround. 4989 4990 Returns 4991 ------- 4992 Pandas Dataframe, each row containing data for a security. The dataframe is 4993 indexed by ticker. 4994 Columns are: 4995 - recommendation: str 4996 - rating: float 4997 - rating_delta: float 4998 - dividend_yield: float 4999 - predicted_excess_return_1m: float 5000 - predicted_excess_return_3m: float 5001 - predicted_excess_return_1y: float 5002 - risk: str 5003 - reward: str 5004 - reason: str 5005 """ 5006 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5007 return client.get_ideas( 5008 model_id=model_id, 5009 portfolio_id=portfolio_id, 5010 investment_horizon=investment_horizon, 5011 delta_horizon=delta_horizon, 5012 ) 5013 5014 5015def getStockRecommendations( 5016 apikey: str, 5017 model_id: str, 5018 portfolio_id: str, 5019 symbols: Optional[List[str]] = None, 5020 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5021 proxy: Optional[str] = None, 5022 disable_verify_ssl: bool = False, 5023) -> pd.DataFrame: 5024 """ 5025 Given a model ID, portfolio ID, optional list of symbols, and a time 5026 horizon, return a dictionary of symbols to stock recommendations. 5027 5028 Parameters 5029 ---------- 5030 apikey: str 5031 API key provided by Boosted. This key should be protected as a secret. 5032 model_id: str 5033 UUID of a Boosted model. 5034 portfolio_id: str 5035 UUID of a Boosted portfolio in the given model. 5036 symbols: Optional[List[str]] 5037 List of symbols for which to fetch recommendation info. If None, will 5038 return recommendations for the entire portfolio. Note that invalid 5039 symbols or symbols without recommendations will not be returned. 5040 investment_horizon: str 5041 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5042 proxy: str 5043 Your organization may require the use of a proxy for access. 5044 The address of a HTTPS proxy in the format of <address>:<port>. 5045 Examples are "123.456.789:123" or "my.proxy.com:123". 5046 Do not prepend with "https://". 5047 disable_verify_ssl: bool 5048 Your networking setup may be behind a firewall which performs SSL 5049 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5050 to point to the location of a custom certificate bundle, or set this 5051 parameter to true to disable SSL verification as a workaround. 5052 5053 Returns 5054 ------- 5055 Pandas Dataframe, each row containing data for a security. The dataframe is 5056 indexed by ticker. The "reasons" column is a dict from a reason's "title" to 5057 its text. 5058 Columns are: 5059 - recommendation: str 5060 - predicted_excess_return_1m: float 5061 - predicted_excess_return_3m: float 5062 - predicted_excess_return_1y: float 5063 - risk: str 5064 - reward: str 5065 - reasons: Dict[str, str] 5066 """ 5067 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5068 return client.get_stock_recommendations( 5069 model_id=model_id, 5070 portfolio_id=portfolio_id, 5071 symbols=symbols, 5072 investment_horizon=investment_horizon, 5073 ) 5074 5075 5076def getStockRecommendationReasons( 5077 apikey: str, 5078 model_id: str, 5079 portfolio_id: str, 5080 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5081 symbols: Optional[List[str]] = None, 5082 proxy: Optional[str] = None, 5083 disable_verify_ssl: bool = False, 5084) -> Dict[str, Optional[List[str]]]: 5085 """ 5086 Given a model ID, portfolio ID, symbols, and a time horizon, return a dictionary 5087 of symbols to stock recommendations. 5088 5089 Parameters 5090 ---------- 5091 apikey: str 5092 API key provided by Boosted. This key should be protected as a secret. 5093 model_id: str 5094 UUID of a Boosted model. 5095 portfolio_id: str 5096 UUID of a Boosted portfolio in the given model. 5097 symbols: List[str] 5098 Optional list of symbols for which to fetch reasons. If None, all symbols 5099 for the given portfolio are fetched. 5100 investment_horizon: str 5101 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5102 proxy: str 5103 Your organization may require the use of a proxy for access. 5104 The address of a HTTPS proxy in the format of <address>:<port>. 5105 Examples are "123.456.789:123" or "my.proxy.com:123". 5106 Do not prepend with "https://". 5107 disable_verify_ssl: bool 5108 Your networking setup may be behind a firewall which performs SSL 5109 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5110 to point to the location of a custom certificate bundle, or set this 5111 parameter to true to disable SSL verification as a workaround. 5112 5113 Returns 5114 ------- 5115 Dictionary: 5116 { 5117 <symbol_0>: [reason_0, reason_1, ...], 5118 <symbol_1>: [reason_0, reason_1, ...] 5119 } 5120 Note that for a passed symbol that has no reasons, the symbol will be present 5121 in the dictionary but will not have any elements in its list, i.e. 5122 >>> print(result["SOME_SYMBOL_WITH_NO_REASONS"]) 5123 [] 5124 Additionally, if a passed symbol is not found as a portfolio holding, the symbol 5125 will be present in the dictionary but will be valued None, i.e. 5126 >>> print(result["SOME_SYMBOL_NOT_FOUND"]) 5127 None 5128 """ 5129 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5130 return client.get_stock_recommendation_reasons( 5131 model_id=model_id, 5132 portfolio_id=portfolio_id, 5133 investment_horizon=investment_horizon, 5134 symbols=symbols, 5135 ) 5136 5137 5138def get_stock_mapping_alternatives( 5139 self, 5140 apikey: str, 5141 isin: Optional[str] = None, 5142 symbol: Optional[str] = None, 5143 country: Optional[str] = None, 5144 currency: Optional[str] = None, 5145 asof_date: Optional[BoostedDate] = None, 5146 proxy: Optional[str] = None, 5147 disable_verify_ssl: bool = False, 5148) -> Dict: 5149 """ 5150 Return the stock mapping for the given criteria, 5151 also suggestions for alternate matches, 5152 if the mapping is not what is wanted 5153 5154 Parameters [One of either ISIN or SYMBOL must be provided] 5155 ---------- 5156 isin: Optional[str] 5157 search by ISIN 5158 symbol: Optional[str] 5159 search by Ticker Symbol 5160 country: Optional[str] 5161 Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" 5162 currency: Optional[str] 5163 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5164 asof_date: Optional[date] 5165 as of which date to perform the search, default is today() 5166 5167 Note: country/currency filter starting with "p_" indicates 5168 only a soft preference but allows other matches 5169 5170 Returns 5171 ------- 5172 Dictionary Representing this 'MapSecurityResponse' structure: 5173 5174 class MapSecurityResponse(): 5175 stock_mapping: Optional[SecurityInfo] 5176 The mapping we would perform given your inputs 5177 5178 alternatives: Optional[List[SecurityInfo]] 5179 Alternative suggestions based on your input 5180 5181 error: Optional[str] 5182 5183 class SecurityInfo(): 5184 gbi_id: int 5185 isin: str 5186 symbol: Optional[str] 5187 country: str 5188 currency: str 5189 name: str 5190 from_date: date 5191 to_date: date 5192 is_primary_trading_item: bool 5193 5194 """ 5195 5196 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5197 return client.get_stock_mapping_alternatives( 5198 isin=isin, symbol=symbol, country=country, currency=currency, asof_date=asof_date 5199 ) 5200 5201 5202def getProsConsForStocks( 5203 apikey: str, 5204 model_id: Optional[str] = None, 5205 symbols: Optional[List[str]] = None, 5206 preferred_country: Optional[str] = None, 5207 preferred_currency: Optional[str] = None, 5208 proxy: Optional[str] = None, 5209 disable_verify_ssl: bool = False, 5210) -> Dict[str, Dict[str, List]]: 5211 """ 5212 Given a model ID OR a list of symbols, return pros/cons for 5213 each stock. Note that unrecognized symbols will be absent from the output. 5214 5215 Parameters 5216 ---------- 5217 apikey: str 5218 API key provided by Boosted. This key should be protected as a secret. 5219 model_id: Optional[str] 5220 UUID of a Boosted model. 5221 symbols: Optional[List[str]] 5222 List of symbols for which to fetch pros/cons. 5223 preferred_country: str 5224 The preferred country for the identifier list, to resolve 5225 abiguities. Should be a 3 character iso code. By default, will try to 5226 figure out the best match. 5227 preferred_currency: str 5228 The preferred currency for the identifier list, to resolve 5229 abiguities. Should be a 3 character iso code. By default, will try to 5230 figure out the best match. 5231 proxy: str 5232 Your organization may require the use of a proxy for access. 5233 The address of a HTTPS proxy in the format of <address>:<port>. 5234 Examples are "123.456.789:123" or "my.proxy.com:123". 5235 Do not prepend with "https://". 5236 disable_verify_ssl: bool 5237 Your networking setup may be behind a firewall which performs SSL 5238 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5239 to point to the location of a custom certificate bundle, or set this 5240 parameter to true to disable SSL verification as a workaround. 5241 5242 Returns 5243 ------- 5244 Dictionary in the following format 5245 { "SYMBOL": 5246 { 5247 "pros": [ 5248 { 5249 "summary": "Increase in service revenue", 5250 "details": "Details..." 5251 }, 5252 ], 5253 "cons": [ 5254 { 5255 "summary": "Increase in cost of vehicle sales", 5256 "details": "Details..." 5257 }, 5258 ] 5259 } 5260 } 5261 """ 5262 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5263 if symbols is None and model_id is None: 5264 raise BoostedAPIException("Must provide either a list of symbols or a model/portfolio") 5265 return client.get_pros_cons_for_stocks( 5266 symbols=symbols, 5267 model_id=model_id, 5268 preferred_country=preferred_country, 5269 preferred_currency=preferred_currency, 5270 ) 5271 5272 5273####################################################################### 5274# NLP 5275####################################################################### 5276def generateTheme( 5277 apikey: str, 5278 theme_name: str, 5279 stock_universes: List[ThemeUniverse], 5280 proxy: Optional[str] = None, 5281 disable_verify_ssl: bool = False, 5282) -> str: 5283 """ 5284 The API to generate a theme for a list of stock universes. 5285 5286 Parameters 5287 ---------- 5288 apikey: str 5289 API key provided by Boosted. This key should be protected as a secret. 5290 theme_name: str 5291 The name of the theme to generate. 5292 stock_universes: List[ThemeUniverse] 5293 The universe of stocks to use for the theme. We currently support the universes in the enum 5294 class `ThemeUniverse`. 5295 proxy: str 5296 Your organization may require the use of a proxy for access. 5297 The address of a HTTPS proxy in the format of <address>:<port>. 5298 Examples are "123.456.789:123" or "my.proxy.com:123". 5299 Do not prepend with "https://". 5300 disable_verify_ssl: bool 5301 Your networking setup may be behind a firewall which performs SSL 5302 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5303 to point to the location of a custom certificate bundle, or set this 5304 parameter to true to disable SSL verification as a workaround. 5305 5306 Returns 5307 ------- 5308 a string of theme id that can be used to query the theme data later. 5309 """ 5310 if not stock_universes: 5311 raise BoostedAPIException("Must provide a list of stock universe IDs") 5312 5313 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5314 return client.generate_theme(theme_name, stock_universes) 5315 5316 5317def getThemesForStock( 5318 apikey: str, 5319 isin: str, 5320 currency: Optional[str] = None, 5321 country: Optional[str] = None, 5322 start_date: Optional[BoostedDate] = None, 5323 end_date: Optional[BoostedDate] = None, 5324 language: Optional[Union[str, Language]] = None, 5325 proxy: Optional[str] = None, 5326 disable_verify_ssl: bool = False, 5327) -> List[Dict]: 5328 """ 5329 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5330 5331 Parameters 5332 ---------- 5333 apikey: str 5334 API key provided by Boosted. This key should be protected as a secret. 5335 isin: str 5336 The ISIN of the stock to get themes for. 5337 currency: Optional[str] 5338 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5339 "ANY", "p_USA", "CAN" 5340 country: Optional[str] 5341 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5342 start_date & end_date: Optional[BoostedDate] 5343 The start and end date to calculate the theme importance. If not provided, the default is 5344 the past 30 days. 5345 language: Optional[str | Language] 5346 Will translate AI generated text into the given language. This may be a 5347 language in the Language enum or any language code supported by Google 5348 Translate. 5349 proxy: str 5350 Your organization may require the use of a proxy for access. 5351 The address of a HTTPS proxy in the format of <address>:<port>. 5352 Examples are "123.456.789:123" or "my.proxy.com:123". 5353 Do not prepend with "https://". 5354 disable_verify_ssl: bool 5355 Your networking setup may be behind a firewall which performs SSL 5356 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5357 to point to the location of a custom certificate bundle, or set this 5358 parameter to true to disable SSL verification as a workaround. 5359 5360 Returns 5361 ------- 5362 A list of below dictionaries 5363 { 5364 themeId: str 5365 themeName: str 5366 importanceScore: float 5367 similarityScore: float 5368 positiveThemeRelation: bool 5369 reason: String 5370 } 5371 """ 5372 if (start_date and not end_date) or (end_date and not start_date): 5373 raise BoostedAPIException("Must provide both start and end dates or neither") 5374 5375 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5376 return client.get_themes_for_stock(isin, currency, country, start_date, end_date, language) 5377 5378 5379def getThemesForStockUniverse( 5380 apikey: str, 5381 stock_universe: ThemeUniverse, 5382 start_date: Optional[BoostedDate] = None, 5383 end_date: Optional[BoostedDate] = None, 5384 language: Optional[Union[str, Language]] = None, 5385 proxy: Optional[str] = None, 5386 disable_verify_ssl: bool = False, 5387) -> List[Dict]: 5388 """ 5389 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5390 5391 Parameters 5392 ---------- 5393 apikey: str 5394 API key provided by Boosted. This key should be protected as a secret. 5395 stock_universe: ThemeUniverse 5396 The universe of stocks to fetch for themes 5397 start_date & end_date: Optional[BoostedDate] 5398 The start and end date to calculate the theme importance. If not provided, the default is 5399 the past 30 days. 5400 language: Optional[str | Language] 5401 Will translate AI generated text into the given language. This may be a 5402 language in the Language enum or any language code supported by Google 5403 Translate. 5404 proxy: str 5405 Your organization may require the use of a proxy for access. 5406 The address of a HTTPS proxy in the format of <address>:<port>. 5407 Examples are "123.456.789:123" or "my.proxy.com:123". 5408 Do not prepend with "https://". 5409 disable_verify_ssl: bool 5410 Your networking setup may be behind a firewall which performs SSL 5411 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5412 to point to the location of a custom certificate bundle, or set this 5413 parameter to true to disable SSL verification as a workaround. 5414 5415 Returns: A list of below dictionaries 5416 ------- 5417 { 5418 themeId: str 5419 themeName: str 5420 themeImportance: float 5421 volatility: float 5422 positiveStockPerformance: float 5423 negativeStockPerformance: float 5424 } 5425 """ 5426 if (start_date and not end_date) or (end_date and not start_date): 5427 raise BoostedAPIException("Must provide both start and end dates or neither") 5428 5429 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5430 return client.get_themes_for_stock_universe(stock_universe, start_date, end_date, language) 5431 5432 5433def getStockNews( 5434 apikey: str, 5435 time_horizon: NewsHorizon, 5436 isin: str, 5437 currency: Optional[str] = None, 5438 country: Optional[str] = None, 5439 language: Optional[Union[str, Language]] = None, 5440 proxy: Optional[str] = None, 5441 disable_verify_ssl: bool = False, 5442) -> Dict: 5443 """ 5444 The API to get a stock's news summary for a given time horizon, the topics summarized by these 5445 news and the corresponding news to these topics 5446 Parameters 5447 ---------- 5448 apikey: str 5449 API key provided by Boosted. This key should be protected as a secret. 5450 time_horizon: NewsHorizon 5451 The time horizon for the company's news, summary, topics 5452 isin: str 5453 The ISIN of the stock to get themes for. 5454 currency: Optional[str] 5455 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5456 "ANY", "p_USA", "CAN" 5457 country: Optional[str] 5458 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5459 language: Optional[str | Language] 5460 Will translate AI generated text into the given language. This may be a 5461 language in the Language enum or any language code supported by Google 5462 Translate. 5463 start_date & end_date: Optional[BoostedDate] 5464 The start and end date to calculate the theme importance. If not provided, the default is 5465 the past 30 days. 5466 proxy: str 5467 Your organization may require the use of a proxy for access. 5468 The address of a HTTPS proxy in the format of <address>:<port>. 5469 Examples are "123.456.789:123" or "my.proxy.com:123". 5470 Do not prepend with "https://". 5471 disable_verify_ssl: bool 5472 Your networking setup may be behind a firewall which performs SSL 5473 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5474 to point to the location of a custom certificate bundle, or set this 5475 parameter to true to disable SSL verification as a workaround. 5476 Returns 5477 ------- 5478 A nested dictionary in the following format: 5479 { 5480 summary: str 5481 topics: [ 5482 { 5483 topicId: str 5484 topicLabel: str 5485 topicDescription: str 5486 topicPolarity: str 5487 newsItems: [ 5488 { 5489 newsId: str 5490 headline: str 5491 url: str 5492 summary: str 5493 source: str 5494 publishedAt: str 5495 } 5496 ] 5497 } 5498 ] 5499 other_news_count: int 5500 } 5501 """ 5502 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5503 return client.get_stock_news(time_horizon, isin, currency, country, language) 5504 5505 5506def getThemeDetails( 5507 apikey: str, 5508 theme_id: str, 5509 universe: ThemeUniverse, 5510 language: Optional[Union[str, Language]] = None, 5511 proxy: Optional[str] = None, 5512 disable_verify_ssl: bool = False, 5513) -> Dict[str, Any]: 5514 """ 5515 Returns detailed theme info for a given theme ID and universe. Theme ID's 5516 can be fetched from the getAllThemeMetadata endpoint. 5517 Parameters 5518 ---------- 5519 apikey: str 5520 API key provided by Boosted. This key should be protected as a secret. 5521 theme_id: str 5522 UUID representing either a boosted theme or a theme owned with the 5523 account associated with the api key. Theme ID's can be fetched from the 5524 getAllThemeMetadata endpoint. 5525 universe: ThemeUniverse 5526 The universe of stocks to use when showing theme details/impacts. 5527 language: Optional[str | Language] 5528 Will translate AI generated text into the given language. This may be a 5529 language in the Language enum or any language code supported by Google 5530 Translate. 5531 proxy: str 5532 Your organization may require the use of a proxy for access. 5533 The address of a HTTPS proxy in the format of <address>:<port>. 5534 Examples are "123.456.789:123" or "my.proxy.com:123". 5535 Do not prepend with "https://". 5536 disable_verify_ssl: bool 5537 Your networking setup may be behind a firewall which performs SSL 5538 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5539 to point to the location of a custom certificate bundle, or set this 5540 parameter to true to disable SSL verification as a workaround. 5541 Returns 5542 ------- 5543 A nested dictionary in the following format: 5544 { 5545 "theme_name": str, 5546 "theme_summary": str, 5547 "impacts": [ 5548 { 5549 "impact_name": str, 5550 "impact_description": str, 5551 "impact_score": float, 5552 "articles": [ 5553 { 5554 "title": str, 5555 "url": str, 5556 "source": str, 5557 "publish_date": str 5558 } 5559 ], 5560 "impact_stocks": [ 5561 { 5562 "isin": str, 5563 "name": str, 5564 "positive_impact_relation": bool 5565 } 5566 ] 5567 } 5568 ], 5569 "stocks": [ 5570 { 5571 "isin": str, 5572 "name": str, 5573 "positive_theme_relation": bool, 5574 "reason": str, 5575 "theme_stock_impact_score": float 5576 } 5577 ], 5578 "developments": [ 5579 { 5580 "name": str, 5581 "article_count": int, 5582 "date": datetime.date, 5583 "description": str, 5584 "is_major_development": bool, 5585 "sentiment": int, (-1, 0, 1) 5586 "news": [ 5587 { 5588 "headline": str, 5589 "published_at": datetime.datetime, 5590 "source": str, 5591 "url": str, 5592 } 5593 ] 5594 } 5595 ] 5596 } 5597 5598 """ 5599 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5600 return client.get_theme_details(theme_id=theme_id, universe=universe, language=language) 5601 5602 5603def getAllThemeMetadata( 5604 apikey: str, 5605 language: Optional[Union[str, Language]] = None, 5606 proxy: Optional[str] = None, 5607 disable_verify_ssl: bool = False, 5608) -> List[Dict[str, Any]]: 5609 """ 5610 Returns metadata about all themes owned by the account associated with the 5611 given API key. 5612 Parameters 5613 ---------- 5614 apikey: str 5615 API key provided by Boosted. This key should be protected as a secret. 5616 language: Optional[str | Language] 5617 Will translate AI generated text into the given language. This may be a 5618 language in the Language enum or any language code supported by Google 5619 Translate. 5620 proxy: str 5621 Your organization may require the use of a proxy for access. 5622 The address of a HTTPS proxy in the format of <address>:<port>. 5623 Examples are "123.456.789:123" or "my.proxy.com:123". 5624 Do not prepend with "https://". 5625 disable_verify_ssl: bool 5626 Your networking setup may be behind a firewall which performs SSL 5627 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5628 to point to the location of a custom certificate bundle, or set this 5629 parameter to true to disable SSL verification as a workaround. 5630 Returns 5631 ------- 5632 A list of dictionaries in the following format: 5633 [ 5634 { 5635 "theme_name": str, 5636 "theme_id": str, 5637 "universes": List[str] 5638 } 5639 ] 5640 5641 """ 5642 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5643 return client.get_all_theme_metadata(language=language) 5644 5645 5646def getEarningsImpactingSecurity( 5647 apikey: str, 5648 isin: str, 5649 currency: Optional[str] = None, 5650 country: Optional[str] = None, 5651 language: Optional[Union[str, Language]] = None, 5652 proxy: Optional[str] = None, 5653 disable_verify_ssl: bool = False, 5654) -> List[Dict[str, Any]]: 5655 """ 5656 Returns upcoming earnings releases that could impact the given security. 5657 Parameters 5658 ---------- 5659 apikey: str 5660 API key provided by Boosted. This key should be protected as a secret. 5661 isin: str 5662 The ISIN of the stock to get themes for. 5663 currency: Optional[str] 5664 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5665 "ANY", "p_USA", "CAN" 5666 country: Optional[str] 5667 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5668 language: Optional[str | Language] 5669 Will translate AI generated text into the given language. This may be a 5670 language in the Language enum or any language code supported by Google 5671 Translate. 5672 start_date & end_date: Optional[BoostedDate] 5673 The start and end date to calculate the theme importance. If not provided, the default is 5674 the past 30 days. 5675 proxy: str 5676 Your organization may require the use of a proxy for access. 5677 The address of a HTTPS proxy in the format of <address>:<port>. 5678 Examples are "123.456.789:123" or "my.proxy.com:123". 5679 Do not prepend with "https://". 5680 disable_verify_ssl: bool 5681 Your networking setup may be behind a firewall which performs SSL 5682 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5683 to point to the location of a custom certificate bundle, or set this 5684 parameter to true to disable SSL verification as a workaround. 5685 Returns 5686 ------- 5687 A list of dictionaries in the following format: 5688 [ 5689 { 5690 "event_date": str, 5691 "company_name": str, 5692 "symbol": str, 5693 "isin": str, 5694 "impact_reason": str 5695 } 5696 ] 5697 5698 """ 5699 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5700 return client.get_earnings_impacting_security( 5701 isin=isin, country=country, currency=currency, language=language 5702 ) 5703 5704 5705def getEarningsInsights( 5706 apikey: str, 5707 isin: str, 5708 currency: Optional[str] = None, 5709 country: Optional[str] = None, 5710 proxy: Optional[str] = None, 5711 disable_verify_ssl: bool = False, 5712) -> Dict[str, Any]: 5713 """ 5714 Returns earnings insights data for a security. This data includes summarized 5715 versions of the two most recent earnings calls, as well as a generated 5716 comparison between them. 5717 Parameters 5718 ---------- 5719 apikey: str 5720 API key provided by Boosted. This key should be protected as a secret. 5721 isin: str 5722 The ISIN of the stock to get earnings data for. 5723 currency: Optional[str] 5724 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5725 "ANY", "p_USA", "CAN" 5726 country: Optional[str] 5727 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5728 proxy: str 5729 Your organization may require the use of a proxy for access. 5730 The address of a HTTPS proxy in the format of <address>:<port>. 5731 Examples are "123.456.789:123" or "my.proxy.com:123". 5732 Do not prepend with "https://". 5733 disable_verify_ssl: bool 5734 Your networking setup may be behind a firewall which performs SSL 5735 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5736 to point to the location of a custom certificate bundle, or set this 5737 parameter to true to disable SSL verification as a workaround. 5738 Returns 5739 ------- 5740 A dictionary in the following format: 5741 { 5742 "earnings_report": 5743 { 5744 "release_date": datetime.date, 5745 "quarter": int, 5746 "year": int, 5747 "details": [ 5748 {"header": str, "detail": str, "sentiment": "str"} 5749 ], 5750 "call_summary": str, 5751 "common_remarks": [ 5752 {"header": str, "detail": str, "sentiment": "str"} 5753 ], 5754 "dropped_remarks": [ 5755 {"header": str, "detail": str, "sentiment": "str"} 5756 ], 5757 "qa_summary": str, 5758 "qa_details": [ 5759 {"header": str, "detail": str, "sentiment": "str"} 5760 ], 5761 }, 5762 "prior_earnings_report": (same as above except dropped_remarks becomes new_remarks), 5763 "report_comparison": [ 5764 {"header": str, "detail": str} 5765 ] 5766 } 5767 """ 5768 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5769 return client.get_earnings_insights_for_stocks(isin=isin, currency=currency, country=country) 5770 5771 5772# i added a comment 5773def getPortfolioInferenceStatus( 5774 apikey: str, 5775 portfolio_id: str, 5776 inference_date: str, 5777 proxy: Optional[str] = None, 5778 disable_verify_ssl: bool = False, 5779) -> Dict[str, Any]: 5780 """ 5781 Returns the live inference status of a portfolio, or the expected finish time if it is 5782 not yet done. 5783 Parameters 5784 ---------- 5785 apikey: str 5786 API key provided by Boosted. This key should be protected as a secret. 5787 portfolio_id: str 5788 The ID of the portfolio. This comes from the URL used to access the portfolio on the screen. 5789 Will be a UUID such as "ffffffff-ffff-ffff-ffff-ffffffffffff" 5790 inference_date: str 5791 YYYY-MM-DD string, such as 2023-09-22 5792 proxy: str 5793 Your organization may require the use of a proxy for access. 5794 The address of a HTTPS proxy in the format of <address>:<port>. 5795 Examples are "123.456.789:123" or "my.proxy.com:123". 5796 Do not prepend with "https://". 5797 disable_verify_ssl: bool 5798 Your networking setup may be behind a firewall which performs SSL 5799 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5800 to point to the location of a custom certificate bundle, or set this 5801 parameter to true to disable SSL verification as a workaround. 5802 Returns 5803 ------- 5804 A dictionary in the following format if portfolio_id has successfully completed on 5805 inference_date: 5806 {"expectedFinishTimeUTC": null, "done": true} 5807 5808 And in the following format if the portfolio_id has not yet completed on inference_date: 5809 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "done": false} 5810 5811 """ 5812 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5813 return client.get_portfolio_inference_status( 5814 portfolio_id=portfolio_id, inference_date=inference_date 5815 )
35def inferDependentDataSetSchema(name, df, infer_from_column_names=False): 36 """ 37 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 38 39 Parameters 40 ---------- 41 datasetName: str 42 Name for this dataset. 43 df: pandas.DataFrame 44 Pandas DataFrame containing your data. The index must be 45 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 46 infer_from_column_names: bool 47 Allows creation of dataset schemas with more flexible identifier columns. 48 Identifier column names must be specified equal to (case and whitespace insensitive) 49 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 50 together as a block in the first N columns of your dataset, where N is the number of 51 identifiers. 52 53 Returns 54 ------- 55 DatasetConfig 56 A DatasetConfig can be used to create a new dataset. 57 """ 58 return infer_dataset_schema( 59 name, df, DataSetType.STOCK, infer_from_column_names=infer_from_column_names 60 )
Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers.
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
63def inferCustomSecurityDailyDataSetSchema( 64 df, infer_from_column_names=False, schema_name="custom_security_daily" 65): 66 """ 67 Creates a custom security daily schema by inferring the contents from a Pandas DataFrame. 68 69 Parameters 70 ---------- 71 df: pandas.DataFrame 72 Pandas DataFrame containing your data. The index must be 73 DatetimeIndex. The columns must be the identifiers: 74 e.g. (custom_security), followed by any features in the dataset. 75 76 For custom security, we expect at minimum a custom security identifier and 77 a close price. The CSV header should look like this: 78 custom_security,daily_close 79 with support for the following optional pricing data columns in total: 80 daily_open 81 daily_close 82 daily_vwap 83 daily_high 84 daily_low 85 daily_bid 86 daily_ask 87 daily_volume (default high volume) 88 daily_mcap (default high mcap) 89 90 infer_from_column_names: bool 91 Allows creation of dataset schemas with more flexible identifier columns. 92 Identifier column names must be specified equal to (case and whitespace insensitive) 93 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 94 together as a block in the first N columns of your dataset, where N is the number of 95 identifiers. 96 97 Returns 98 ------- 99 DatasetConfig 100 A DatasetConfig can be used to create a new dataset. 101 """ 102 return infer_dataset_schema( 103 schema_name, 104 df, 105 DataSetType.SECURITIES_DAILY, 106 infer_from_column_names=infer_from_column_names, 107 )
Creates a custom security daily schema by inferring the contents from a Pandas DataFrame.
Parameters
df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The columns must be the identifiers: e.g. (custom_security), followed by any features in the dataset.
For custom security, we expect at minimum a custom security identifier and
a close price. The CSV header should look like this:
custom_security,daily_close
with support for the following optional pricing data columns in total:
daily_open
daily_close
daily_vwap
daily_high
daily_low
daily_bid
daily_ask
daily_volume (default high volume)
daily_mcap (default high mcap)
infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers.
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
110def inferDependentHistoricalQuarterlyDataSetSchema( 111 name, df, infer_dataset_report_period=True, infer_from_column_names=False 112): 113 """ 114 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 115 116 Parameters 117 ---------- 118 datasetName: str 119 Name for this dataset. 120 df: pandas.DataFrame 121 Pandas DataFrame containing your data. The index must be 122 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 123 infer_from_column_names: bool 124 Allows creation of dataset schemas with more flexible identifier columns. 125 Identifier column names must be specified equal to (case and whitespace insensitive) 126 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 127 together as a block in the first N columns of your dataset, where N is the number of 128 identifiers. 129 infer_dataset_report_period: bool 130 Allow the report period to be inferred based on the report date 131 132 Returns 133 ------- 134 DatasetConfig 135 A DatasetConfig can be used to create a new dataset. 136 """ 137 return infer_dataset_schema( 138 name, 139 df, 140 DataSetType.STOCK, 141 dataset_subtype=DataSetSubType.SPARSE_HIST, 142 dataset_frequency=DataSetFrequency.QUARTERLY, 143 infer_dataset_report_period=infer_dataset_report_period, 144 infer_from_column_names=infer_from_column_names, 145 )
Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers. infer_dataset_report_period: bool Allow the report period to be inferred based on the report date
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
148def inferDependentForwardQuarterlyDataSetSchema( 149 name, df, infer_dataset_report_period=True, infer_from_column_names=False 150): 151 """ 152 Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame. 153 154 Parameters 155 ---------- 156 datasetName: str 157 Name for this dataset. 158 df: pandas.DataFrame 159 Pandas DataFrame containing your data. The index must be 160 DatetimeIndex. The first columns must be ISIN, Country, Currency by default. 161 infer_from_column_names: bool 162 Allows creation of dataset schemas with more flexible identifier columns. 163 Identifier column names must be specified equal to (case and whitespace insensitive) 164 one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped 165 together as a block in the first N columns of your dataset, where N is the number of 166 identifiers. 167 infer_dataset_report_period: bool 168 Allow the report period to be inferred based on the report date 169 170 Returns 171 ------- 172 DatasetConfig 173 A DatasetConfig can be used to create a new dataset. 174 """ 175 return infer_dataset_schema( 176 name, 177 df, 178 DataSetType.STOCK, 179 dataset_subtype=DataSetSubType.SPARSE_FWD, 180 dataset_frequency=DataSetFrequency.QUARTERLY, 181 infer_dataset_report_period=infer_dataset_report_period, 182 infer_from_column_names=infer_from_column_names, 183 )
Creates a dependent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. infer_from_column_names: bool Allows creation of dataset schemas with more flexible identifier columns. Identifier column names must be specified equal to (case and whitespace insensitive) one of the values in boosted.api.api_type.ColumnSubRole. These columns must be grouped together as a block in the first N columns of your dataset, where N is the number of identifiers. infer_dataset_report_period: bool Allow the report period to be inferred based on the report date
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
186def inferIndependentDataSetSchema(name, df): 187 """ 188 Creates a independent dataset schema by inferring the contents from a Pandas DataFrame. 189 190 Parameters 191 ---------- 192 datasetName: str 193 Name for this dataset. 194 df: pandas.DataFrame 195 Pandas DataFrame containing your data. The index must be 196 DatetimeIndex. The first column must be a unique custom security identifier 197 198 Returns 199 ------- 200 DatasetConfig 201 A DatasetConfig can be used to create a new dataset. 202 """ 203 return infer_dataset_schema(name, df, DataSetType.STRATEGY, infer_from_column_names=False)
Creates a independent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be a unique custom security identifier
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
206def inferGlobalDataSetSchema(name, df): 207 """ 208 Creates a independent dataset schema by inferring the contents from a Pandas DataFrame. 209 210 Parameters 211 ---------- 212 datasetName: str 213 Name for this dataset. 214 df: pandas.DataFrame 215 Pandas DataFrame containing your data. The index must be 216 DatetimeIndex. 217 218 Returns 219 ------- 220 DatasetConfig 221 A DatasetConfig can be used to create a new dataset. 222 """ 223 return infer_dataset_schema(name, df, DataSetType.GLOBAL, infer_from_column_names=False)
Creates a independent dataset schema by inferring the contents from a Pandas DataFrame.
Parameters
datasetName: str Name for this dataset. df: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex.
Returns
DatasetConfig A DatasetConfig can be used to create a new dataset.
226def getDataSetSchema(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 227 """ 228 Retrieves a DataSetConfig representing the schema of an existing dataset. 229 230 Parameters 231 ---------- 232 apikey: str 233 API key provided by Boosted. This key should be protected as a secret. 234 dataset_id: str 235 Dataset ID. Can be from the output of addIndependentDataset or be found 236 in your Custom Data listing in Boosted Insights. 237 proxy: str 238 Your organization may require the use of a proxy for access. 239 The address of a HTTPS proxy in the format of <address>:<port>. 240 Examples are "123.456.789:123" or "my.proxy.com:123". 241 Do not prepend with "https://". 242 disable_verify_ssl: bool 243 Your networking setup may be behind a firewall which performs SSL 244 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 245 to point to the location of a custom certificate bundle, or set this 246 parameter to true to disable SSL verification as a workaround. 247 248 Returns 249 ------- 250 DataSetConfig 251 A DataSetConfig can be used to create a new dataset. 252 """ 253 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 254 return client.get_dataset_schema(dataset_id)
Retrieves a DataSetConfig representing the schema of an existing dataset.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
DataSetConfig A DataSetConfig can be used to create a new dataset.
257def addDependentDataset( 258 apikey, 259 dataset, 260 datasetName="DependentDataset", 261 datasetConfig=None, 262 proxy=None, 263 disable_verify_ssl=False, 264 timeout: int = 600, 265 block: bool = True, 266): 267 """ 268 Creates a new dependent dataset. 269 270 Creates a new dataset by inferring a schema from your dataset. This will 271 also upload the dataset. 272 273 See http://docs.insights.boosted.ai/integrated-data for more information 274 on formatting. 275 276 Parameters 277 ---------- 278 apikey: str 279 API key provided by Boosted. This key should be protected as a secret. 280 dataset: pandas.DataFrame 281 Pandas DataFrame containing your data. The index must be 282 DatetimeIndex. The first columns must be ISIN, Country, Currency, 283 or comprise all identifier columns in the dataset schema if a schema was 284 specified 285 datasetName: str 286 Name for this dataset. 287 datasetConfig: DatasetConfig 288 A pre-configured dataset schema 289 proxy: str 290 Your organization may require the use of a proxy for access. 291 The address of a HTTPS proxy in the format of <address>:<port>. 292 Examples are "123.456.789:123" or "my.proxy.com:123". 293 Do not prepend with "https://". 294 disable_verify_ssl: bool 295 Your networking setup may be behind a firewall which performs SSL 296 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 297 to point to the location of a custom certificate bundle, or set this 298 parameter to true to disable SSL verification as a workaround. 299 timeout: int = 600 300 Number of seconds before a timeout error should be triggered. 301 block: bool = True 302 Whether the python process should block until the dataset is fully 303 uploaded and processed. 304 305 Returns 306 ------- 307 str 308 Dataset ID of the newly created dataset. 309 """ 310 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 311 return client.add_dependent_dataset( 312 dataset, datasetName, datasetConfig, timeout=timeout, block=block 313 )
Creates a new dependent dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/integrated-data for more information on formatting.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency, or comprise all identifier columns in the dataset schema if a schema was specified datasetName: str Name for this dataset. datasetConfig: DatasetConfig A pre-configured dataset schema proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset ID of the newly created dataset.
316def addIndependentDataset( 317 apikey, 318 dataset, 319 datasetName="IndependentDataset", 320 datasetConfig=None, 321 proxy=None, 322 disable_verify_ssl=False, 323 timeout: int = 600, 324 block: bool = True, 325): 326 """ 327 Creates a new independent dataset. 328 329 Creates a new dataset by inferring a schema from your dataset. This will 330 also upload the dataset. 331 332 See http://docs.insights.boosted.ai/independent-data for more information 333 on formatting. 334 335 Parameters 336 ---------- 337 apikey: str 338 API key provided by Boosted. This key should be protected as a secret. 339 dataset: pandas.DataFrame 340 Pandas DataFrame containing your data. The index must be 341 DatetimeIndex. The first column must be a unique custom security identifier 342 datasetName: str 343 Name for this dataset. 344 datasetConfig: DatasetConfig 345 A pre-configured dataset schema 346 proxy: str 347 Your organization may require the use of a proxy for access. 348 The address of a HTTPS proxy in the format of <address>:<port>. 349 Examples are "123.456.789:123" or "my.proxy.com:123". 350 Do not prepend with "https://". 351 disable_verify_ssl: bool 352 Your networking setup may be behind a firewall which performs SSL 353 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 354 to point to the location of a custom certificate bundle, or set this 355 parameter to true to disable SSL verification as a workaround. 356 timeout: int = 600 357 Number of seconds before a timeout error should be triggered. 358 block: bool = True 359 Whether the python process should block until the dataset is fully 360 uploaded and processed. 361 362 Returns 363 ------- 364 str 365 Dataset ID of the newly created dataset. 366 """ 367 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 368 return client.add_independent_dataset( 369 dataset, datasetName, datasetConfig, timeout=timeout, block=block 370 )
Creates a new independent dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/independent-data for more information on formatting.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be a unique custom security identifier datasetName: str Name for this dataset. datasetConfig: DatasetConfig A pre-configured dataset schema proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset ID of the newly created dataset.
373def addGlobalDataset( 374 apikey, 375 dataset, 376 datasetName="GlobalDataset", 377 datasetConfig=None, 378 proxy=None, 379 disable_verify_ssl=False, 380 timeout: int = 600, 381 block: bool = True, 382): 383 """ 384 Creates a new global dataset. 385 386 Creates a new dataset by inferring a schema from your dataset. This will 387 also upload the dataset. 388 389 See http://docs.insights.boosted.ai/global-data for more information 390 on formatting. 391 392 Parameters 393 ---------- 394 apikey: str 395 API key provided by Boosted. This key should be protected as a secret. 396 dataset: pandas.DataFrame 397 Pandas DataFrame containing your data. The index must be 398 DatetimeIndex. 399 datasetName: str 400 Name for this dataset. 401 datasetConfig: DatasetConfig 402 A pre-configured dataset schema 403 proxy: str 404 Your organization may require the use of a proxy for access. 405 The address of a HTTPS proxy in the format of <address>:<port>. 406 Examples are "123.456.789:123" or "my.proxy.com:123". 407 Do not prepend with "https://". 408 disable_verify_ssl: bool 409 Your networking setup may be behind a firewall which performs SSL 410 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 411 to point to the location of a custom certificate bundle, or set this 412 parameter to true to disable SSL verification as a workaround. 413 timeout: int = 600 414 Number of seconds before a timeout error should be triggered. 415 block: bool = True 416 Whether the python process should block until the dataset is fully 417 uploaded and processed. 418 419 Returns 420 ------- 421 str 422 Dataset ID of the newly created dataset. 423 """ 424 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 425 return client.add_global_dataset( 426 dataset, datasetName, datasetConfig, timeout=timeout, block=block 427 )
Creates a new global dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/global-data for more information on formatting.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. datasetName: str Name for this dataset. datasetConfig: DatasetConfig A pre-configured dataset schema proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset ID of the newly created dataset.
430def addCustomSecurityNamespaceMembers( 431 apikey, 432 namespace, 433 members, 434 proxy, 435 disable_verify_ssl=False, 436): 437 """ 438 Uploads namespace members (tickers, or stock identifiers) into the specified 439 security namespace. 440 441 Parameters 442 ---------- 443 apikey: str 444 API key provided by Boosted. This key should be protected as a secret. 445 namespace: str 446 Namespace to upload to. This is any string representing a private collection of 447 securities that you may refer to with the format <namespace>\\<symbol> 448 in other custom data uploads. 449 members: DataFrame | str 450 A CSV or dataframe representing a CSV containing the securities to upload 451 This tabular data should have columns 452 Symbol Country Currency Name 453 case sensitive, where country and currency are 3-letter ISO country/currency codes. 454 proxy: str 455 Your organization may require the use of a proxy for access. 456 The address of a HTTPS proxy in the format of <address>:<port>. 457 Examples are "123.456.789:123" or "my.proxy.com:123". 458 Do not prepend with "https://". 459 disable_verify_ssl: bool 460 Your networking setup may be behind a firewall which performs SSL 461 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 462 to point to the location of a custom certificate bundle, or set this 463 parameter to true to disable SSL verification as a workaround. 464 465 466 Returns 467 ------- 468 str 469 Dataset ID of the newly created dataset. 470 """ 471 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 472 return client.add_custom_security_namespace_members(namespace, members)
Uploads namespace members (tickers, or stock identifiers) into the specified security namespace.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
namespace: str
Namespace to upload to. This is any string representing a private collection of
securities that you may refer to with the format
Returns
str Dataset ID of the newly created dataset.
475def addCustomSecurityDailyData( 476 apikey, 477 namespace, 478 dataset, 479 datasetConfig=None, 480 proxy=None, 481 disable_verify_ssl=False, 482): 483 """ 484 Creates a new custom security daily dataset. 485 486 Creates a new dataset by inferring a schema from your dataset. This will 487 also upload the dataset. 488 489 See http://docs.insights.boosted.ai/integrated-data for more information 490 on formatting. 491 492 Parameters 493 ---------- 494 apikey: str 495 API key provided by Boosted. This key should be protected as a secret. 496 namespace: str 497 Namespace to upload to. This is any string representing a private collection of 498 securities that you may refer to with the format <namespace>\\<symbol> 499 in other custom data uploads. 500 dataset: pandas.DataFrame 501 Pandas DataFrame containing your data. The index must be 502 DatetimeIndex. 503 504 For custom security, we expect at minimum a custom security identifier and 505 a close price. The CSV header should look like this: 506 custom_security,daily_close 507 with support for the following pricing data fields in total: 508 daily_open 509 daily_close 510 daily_vwap 511 daily_high 512 daily_low 513 daily_bid 514 daily_ask 515 daily_volume (default high volume) 516 daily_mcap (default high mcap) 517 The custom security column should contain the symbols uploaded to the namespace above. 518 519 Please note that any missing values (nans, empty csv fields) are converted to 520 field-level defaults, which are usually 0.0 for pricing fields and a large 521 number for market cap and volume for assumed liquidity. 522 523 datasetConfig: DatasetConfig 524 A pre-configured dataset schema. 525 proxy: str 526 Your organization may require the use of a proxy for access. 527 The address of a HTTPS proxy in the format of <address>:<port>. 528 Examples are "123.456.789:123" or "my.proxy.com:123". 529 Do not prepend with "https://". 530 disable_verify_ssl: bool 531 Your networking setup may be behind a firewall which performs SSL 532 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 533 to point to the location of a custom certificate bundle, or set this 534 parameter to true to disable SSL verification as a workaround. 535 536 Returns 537 ------- 538 str 539 Dataset id of the dataset uploaded to through the namespace. 540 """ 541 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 542 return client.add_custom_security_daily_dataset(namespace, dataset, schema=datasetConfig)
Creates a new custom security daily dataset.
Creates a new dataset by inferring a schema from your dataset. This will also upload the dataset.
See http://docs.insights.boosted.ai/integrated-data for more information on formatting.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
namespace: str
Namespace to upload to. This is any string representing a private collection of
securities that you may refer to with the format
For custom security, we expect at minimum a custom security identifier and
a close price. The CSV header should look like this:
custom_security,daily_close
with support for the following pricing data fields in total:
daily_open
daily_close
daily_vwap
daily_high
daily_low
daily_bid
daily_ask
daily_volume (default high volume)
daily_mcap (default high mcap)
The custom security column should contain the symbols uploaded to the namespace above.
Please note that any missing values (nans, empty csv fields) are converted to
field-level defaults, which are usually 0.0 for pricing fields and a large
number for market cap and volume for assumed liquidity.
datasetConfig: DatasetConfig A pre-configured dataset schema. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Dataset id of the dataset uploaded to through the namespace.
545def exportDependentDataset( 546 apikey, 547 dataset_id, 548 start=None, 549 end=None, 550 proxy=None, 551 disable_verify_ssl=False, 552 timeout: int = 600, 553): 554 """ 555 Exports an existing dependent dataset. 556 557 Exports an existing dataset identified by a dataset ID. Returns the data 558 as a Pandas DataFrame. 559 560 Parameters 561 ---------- 562 apikey: str 563 API key provided by Boosted. This key should be protected as a secret. 564 dataset_id: str 565 Dataset ID. Can be from the output of addDependentDataset or be found 566 in your Custom Data listing in Boosted Insights. 567 start: datetime.date or YYYY-MM-DD string 568 The date from which data will be exported. 569 end: datetime.date or YYYY-MM-DD string 570 The date until which data will be exported. 571 proxy: str 572 Your organization may require the use of a proxy for access. 573 The address of a HTTPS proxy in the format of <address>:<port>. 574 Examples are "123.456.789:123" or "my.proxy.com:123". 575 Do not prepend with "https://". 576 disable_verify_ssl: bool 577 Your networking setup may be behind a firewall which performs SSL 578 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 579 to point to the location of a custom certificate bundle, or set this 580 parameter to true to disable SSL verification as a workaround. 581 timeout: int = 600 582 Number of seconds before a timeout error should be triggered. 583 584 Returns 585 ------- 586 pandas.DataFrame 587 Pandas DataFrame containing your data that will be indexed by the date. 588 The DataFrame schema is identical to the one used to upload a dataset. 589 """ 590 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 591 return client.export_dependent_data(dataset_id, start=start, end=end, timeout=timeout)
Exports an existing dependent dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. start: datetime.date or YYYY-MM-DD string The date from which data will be exported. end: datetime.date or YYYY-MM-DD string The date until which data will be exported. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
594def exportIndependentDataset( 595 apikey, 596 dataset_id, 597 start=(datetime.date.today() - timedelta(days=365 * 25)), 598 end=datetime.date.today(), 599 proxy=None, 600 disable_verify_ssl=False, 601 timeout: int = 600, 602): 603 """ 604 Exports an existing independent dataset. 605 606 Exports an existing dataset identified by a dataset ID. Returns the data 607 as a Pandas DataFrame. 608 609 Parameters 610 ---------- 611 apikey: str 612 API key provided by Boosted. This key should be protected as a secret. 613 dataset_id: str 614 Dataset ID. Can be from the output of addIndependentDataset or be found 615 in your Custom Data listing in Boosted Insights. 616 start: datetime.date or YYYY-MM-DD string 617 The date from which data will be exported. 618 end: datetime.date or YYYY-MM-DD string 619 The date until which data will be exported. 620 proxy: str 621 Your organization may require the use of a proxy for access. 622 The address of a HTTPS proxy in the format of <address>:<port>. 623 Examples are "123.456.789:123" or "my.proxy.com:123". 624 Do not prepend with "https://". 625 disable_verify_ssl: bool 626 Your networking setup may be behind a firewall which performs SSL 627 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 628 to point to the location of a custom certificate bundle, or set this 629 parameter to true to disable SSL verification as a workaround. 630 timeout: int = 600 631 Number of seconds before a timeout error should be triggered. 632 633 Returns 634 ------- 635 pandas.DataFrame 636 Pandas DataFrame containing your data that will be indexed by the date. 637 The DataFrame schema is identical to the one used to upload a dataset. 638 """ 639 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 640 return client.export_independent_data(dataset_id, start, end, timeout=timeout)
Exports an existing independent dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. start: datetime.date or YYYY-MM-DD string The date from which data will be exported. end: datetime.date or YYYY-MM-DD string The date until which data will be exported. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
643def exportGlobalDataset( 644 apikey, 645 dataset_id, 646 start=(datetime.date.today() - timedelta(days=365 * 25)), 647 end=datetime.date.today(), 648 proxy=None, 649 disable_verify_ssl=False, 650 timeout: int = 600, 651): 652 """ 653 Exports an existing global dataset. 654 655 Exports an existing dataset identified by a dataset ID. Returns the data 656 as a Pandas DataFrame. 657 658 Parameters 659 ---------- 660 apikey: str 661 API key provided by Boosted. This key should be protected as a secret. 662 dataset_id: str 663 Dataset ID. Can be from the output of addGlobalDataset or be found 664 in your Custom Data listing in Boosted Insights. 665 start: datetime.date or YYYY-MM-DD string 666 The date from which data will be exported. 667 end: datetime.date or YYYY-MM-DD string 668 The date until which data will be exported. 669 proxy: str 670 Your organization may require the use of a proxy for access. 671 The address of a HTTPS proxy in the format of <address>:<port>. 672 Examples are "123.456.789:123" or "my.proxy.com:123". 673 Do not prepend with "https://". 674 disable_verify_ssl: bool 675 Your networking setup may be behind a firewall which performs SSL 676 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 677 to point to the location of a custom certificate bundle, or set this 678 parameter to true to disable SSL verification as a workaround. 679 timeout: int = 600 680 Number of seconds before a timeout error should be triggered. 681 682 Returns 683 ------- 684 pandas.DataFrame 685 Pandas DataFrame containing your data that will be indexed by the date. 686 The DataFrame schema is identical to the one used to upload a dataset. 687 """ 688 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 689 return client.export_global_data(dataset_id, start, end, timeout=timeout)
Exports an existing global dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addGlobalDataset or be found in your Custom Data listing in Boosted Insights. start: datetime.date or YYYY-MM-DD string The date from which data will be exported. end: datetime.date or YYYY-MM-DD string The date until which data will be exported. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
692def exportCustomSecurityDataset( 693 apikey, 694 dataset_id, 695 start=(datetime.date.today() - timedelta(days=365 * 25)), 696 end=datetime.date.today(), 697 proxy=None, 698 disable_verify_ssl=False, 699): 700 """ 701 Exports an existing custom security dataset. 702 703 Exports an existing dataset identified by a dataset ID. Returns the data 704 as a Pandas DataFrame. 705 706 Parameters 707 ---------- 708 apikey: str 709 API key provided by Boosted. This key should be protected as a secret. 710 dataset_id: str 711 Dataset ID of the custom security dataset. This is not a namespace, but 712 rather the output of addCustomSecurityDailyData. 713 start: datetime.date 714 Starting date range to export. Defaults to today minus 25 years. 715 end: datetime.date 716 Ending date range to export. Defaults to today. 717 proxy: str 718 Your organization may require the use of a proxy for access. 719 The address of a HTTPS proxy in the format of <address>:<port>. 720 Examples are "123.456.789:123" or "my.proxy.com:123". 721 Do not prepend with "https://". 722 disable_verify_ssl: bool 723 Your networking setup may be behind a firewall which performs SSL 724 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 725 to point to the location of a custom certificate bundle, or set this 726 parameter to true to disable SSL verification as a workaround. 727 728 Returns 729 ------- 730 pandas.DataFrame 731 Pandas DataFrame containing your data that will be indexed by the date. 732 The DataFrame schema is identical to the one used to upload a dataset. 733 """ 734 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 735 return client.export_custom_security_data(dataset_id, start=start, end=end)
Exports an existing custom security dataset.
Exports an existing dataset identified by a dataset ID. Returns the data as a Pandas DataFrame.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID of the custom security dataset. This is not a namespace, but rather the output of addCustomSecurityDailyData. start: datetime.date Starting date range to export. Defaults to today minus 25 years. end: datetime.date Ending date range to export. Defaults to today. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data that will be indexed by the date. The DataFrame schema is identical to the one used to upload a dataset.
738def addDependentData( 739 apikey, 740 dataset_id, 741 dataset, 742 proxy=None, 743 disable_verify_ssl=False, 744 timeout: int = 600, 745 block: bool = True, 746): 747 """ 748 Adds data to an existing dependent dataset. 749 750 This uploads the data in ``dataset`` to an existing dataset. Existing 751 date/ISIN pairs will be overwritten. 752 753 Parameters 754 ---------- 755 apikey: str 756 API key provided by Boosted. This key should be protected as a secret. 757 dataset_id: str 758 Dataset ID. Can be from the output of addDependentDataset or be found 759 in your Custom Data listing in Boosted Insights. 760 dataset: pandas.DataFrame 761 Pandas DataFrame containing your data. The index must be 762 DatetimeIndex. The first columns must comprise all identifier columns in the 763 dataset schema. 764 proxy: str 765 Your organization may require the use of a proxy for access. 766 The address of a HTTPS proxy in the format of <address>:<port>. 767 Examples are "123.456.789:123" or "my.proxy.com:123". 768 Do not prepend with "https://". 769 disable_verify_ssl: bool 770 Your networking setup may be behind a firewall which performs SSL 771 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 772 to point to the location of a custom certificate bundle, or set this 773 parameter to true to disable SSL verification as a workaround. 774 timeout: int = 600 775 Number of seconds before a timeout error should be triggered. 776 block: bool = True 777 Whether the python process should block until the dataset is fully 778 uploaded and processed. 779 780 Returns 781 ------- 782 None 783 """ 784 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 785 return client.add_dependent_data( 786 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 787 )
Adds data to an existing dependent dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/ISIN pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must comprise all identifier columns in the dataset schema. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
790def addIndependentData( 791 apikey, 792 dataset_id, 793 dataset, 794 proxy=None, 795 disable_verify_ssl=False, 796 timeout: int = 600, 797 block: bool = True, 798): 799 """ 800 Adds data to an existing independent dataset. 801 802 This uploads the data in ``dataset`` to an existing dataset. Existing 803 dates will be overwritten. 804 805 Parameters 806 ---------- 807 apikey: str 808 API key provided by Boosted. This key should be protected as a secret. 809 dataset_id: str 810 Dataset ID. Can be from the output of addIndependentDataset or be found 811 in your Custom Data listing in Boosted Insights. 812 dataset: pandas.DataFrame 813 Pandas DataFrame containing your data. The index must be 814 DatetimeIndex. 815 proxy: str 816 Your organization may require the use of a proxy for access. 817 The address of a HTTPS proxy in the format of <address>:<port>. 818 Examples are "123.456.789:123" or "my.proxy.com:123". 819 Do not prepend with "https://". 820 disable_verify_ssl: bool 821 Your networking setup may be behind a firewall which performs SSL 822 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 823 to point to the location of a custom certificate bundle, or set this 824 parameter to true to disable SSL verification as a workaround. 825 timeout: int = 600 826 Number of seconds before a timeout error should be triggered. 827 block: bool = True 828 Whether the python process should block until the dataset is fully 829 uploaded and processed. 830 831 Returns 832 ------- 833 None 834 """ 835 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 836 return client.add_independent_data( 837 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 838 )
Adds data to an existing independent dataset.
This uploads the data in dataset
to an existing dataset. Existing
dates will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
841def addGlobalData( 842 apikey, 843 dataset_id, 844 dataset, 845 proxy=None, 846 disable_verify_ssl=False, 847 timeout: int = 600, 848 block: bool = True, 849): 850 """ 851 Adds data to an existing global dataset. 852 853 This uploads the data in ``dataset`` to an existing dataset. Existing 854 date/custom security identifier pairs will be overwritten. 855 856 Parameters 857 ---------- 858 apikey: str 859 API key provided by Boosted. This key should be protected as a secret. 860 dataset_id: str 861 Dataset ID. Can be from the output of addGlobalDataset or be found 862 in your Custom Data listing in Boosted Insights. 863 dataset: pandas.DataFrame 864 Pandas DataFrame containing your data. The index must be 865 DatetimeIndex. The first column must be custom security identifier 866 proxy: str 867 Your organization may require the use of a proxy for access. 868 The address of a HTTPS proxy in the format of <address>:<port>. 869 Examples are "123.456.789:123" or "my.proxy.com:123". 870 Do not prepend with "https://". 871 disable_verify_ssl: bool 872 Your networking setup may be behind a firewall which performs SSL 873 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 874 to point to the location of a custom certificate bundle, or set this 875 parameter to true to disable SSL verification as a workaround. 876 timeout: int = 600 877 Number of seconds before a timeout error should be triggered. 878 block: bool = True 879 Whether the python process should block until the dataset is fully 880 uploaded and processed. 881 882 Returns 883 ------- 884 None 885 """ 886 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 887 return client.add_global_data( 888 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.HISTORICAL 889 )
Adds data to an existing global dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/custom security identifier pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addGlobalDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be custom security identifier proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
892def addLiveDependentData( 893 apikey, 894 dataset_id, 895 dataset, 896 proxy=None, 897 disable_verify_ssl=False, 898 timeout: int = 600, 899 block: bool = True, 900): 901 """ 902 Adds live data to an existing dependent dataset. 903 904 This uploads the data in ``dataset`` to an existing dataset. Existing 905 date/ISIN pairs will be overwritten. 906 907 Parameters 908 ---------- 909 apikey: str 910 API key provided by Boosted. This key should be protected as a secret. 911 dataset_id: str 912 Dataset ID. Can be from the output of addDependentDataset or be found 913 in your Custom Data listing in Boosted Insights. 914 dataset: pandas.DataFrame 915 Pandas DataFrame containing your data. The index must be 916 DatetimeIndex. The first columns must be ISIN, Country, Currency. 917 proxy: str 918 Your organization may require the use of a proxy for access. 919 The address of a HTTPS proxy in the format of <address>:<port>. 920 Examples are "123.456.789:123" or "my.proxy.com:123". 921 Do not prepend with "https://". 922 disable_verify_ssl: bool 923 Your networking setup may be behind a firewall which performs SSL 924 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 925 to point to the location of a custom certificate bundle, or set this 926 parameter to true to disable SSL verification as a workaround. 927 timeout: int = 600 928 Number of seconds before a timeout error should be triggered. 929 block: bool = True 930 Whether the python process should block until the dataset is fully 931 uploaded and processed. 932 933 Returns 934 ------- 935 None 936 """ 937 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 938 return client.add_dependent_data( 939 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 940 )
Adds live data to an existing dependent dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/ISIN pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
943def addLiveIndependentData( 944 apikey, 945 dataset_id, 946 dataset, 947 proxy=None, 948 disable_verify_ssl=False, 949 timeout: int = 600, 950 block: bool = True, 951): 952 """ 953 Adds live data to an existing independent dataset. 954 955 This uploads the data in ``dataset`` to an existing dataset. Existing 956 dates will be overwritten. 957 958 Parameters 959 ---------- 960 apikey: str 961 API key provided by Boosted. This key should be protected as a secret. 962 dataset_id: str 963 Dataset ID. Can be from the output of addIndependentDataset or be found 964 in your Custom Data listing in Boosted Insights. 965 dataset: pandas.DataFrame 966 Pandas DataFrame containing your data. The index must be 967 DatetimeIndex. 968 proxy: str 969 Your organization may require the use of a proxy for access. 970 The address of a HTTPS proxy in the format of <address>:<port>. 971 Examples are "123.456.789:123" or "my.proxy.com:123". 972 Do not prepend with "https://". 973 disable_verify_ssl: bool 974 Your networking setup may be behind a firewall which performs SSL 975 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 976 to point to the location of a custom certificate bundle, or set this 977 parameter to true to disable SSL verification as a workaround. 978 timeout: int = 600 979 Number of seconds before a timeout error should be triggered. 980 block: bool = True 981 Whether the python process should block until the dataset is fully 982 uploaded and processed. 983 984 Returns 985 ------- 986 None 987 """ 988 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 989 return client.add_independent_data( 990 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 991 )
Adds live data to an existing independent dataset.
This uploads the data in dataset
to an existing dataset. Existing
dates will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addIndependentDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
994def addLiveGlobalData( 995 apikey, 996 dataset_id, 997 dataset, 998 proxy=None, 999 disable_verify_ssl=False, 1000 timeout: int = 600, 1001 block: bool = True, 1002): 1003 """ 1004 Adds live data to an existing global dataset. 1005 1006 This uploads the data in ``dataset`` to an existing dataset. Existing 1007 date/custom security identifier pairs will be overwritten. 1008 1009 Parameters 1010 ---------- 1011 apikey: str 1012 API key provided by Boosted. This key should be protected as a secret. 1013 dataset_id: str 1014 Dataset ID. Can be from the output of addGlobalDataset or be found 1015 in your Custom Data listing in Boosted Insights. 1016 dataset: pandas.DataFrame 1017 Pandas DataFrame containing your data. The index must be 1018 DatetimeIndex. The first column must be custom security identifier 1019 proxy: str 1020 Your organization may require the use of a proxy for access. 1021 The address of a HTTPS proxy in the format of <address>:<port>. 1022 Examples are "123.456.789:123" or "my.proxy.com:123". 1023 Do not prepend with "https://". 1024 disable_verify_ssl: bool 1025 Your networking setup may be behind a firewall which performs SSL 1026 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1027 to point to the location of a custom certificate bundle, or set this 1028 parameter to true to disable SSL verification as a workaround. 1029 timeout: int = 600 1030 Number of seconds before a timeout error should be triggered. 1031 block: bool = True 1032 Whether the python process should block until the dataset is fully 1033 uploaded and processed. 1034 1035 Returns 1036 ------- 1037 None 1038 """ 1039 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1040 return client.add_global_data( 1041 dataset_id, dataset, timeout=timeout, block=block, data_type=DataAddType.LIVE 1042 )
Adds live data to an existing global dataset.
This uploads the data in dataset
to an existing dataset. Existing
date/custom security identifier pairs will be overwritten.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addGlobalDataset or be found in your Custom Data listing in Boosted Insights. dataset: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first column must be custom security identifier proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
1045def queryDataset(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 1046 """ 1047 Queries the status, timerange of a dataset. 1048 1049 Returns meta-information about a dataset. This can be used to check the 1050 dateranges covered and the current status. 1051 1052 Parameters 1053 ---------- 1054 apikey: str 1055 API key provided by Boosted. This key should be protected as a secret. 1056 dataset_id: str 1057 Dataset ID. Can be from the output of addDependentDataset or be found 1058 in your Custom Data listing in Boosted Insights. 1059 proxy: str 1060 Your organization may require the use of a proxy for access. 1061 The address of a HTTPS proxy in the format of <address>:<port>. 1062 Examples are "123.456.789:123" or "my.proxy.com:123". 1063 Do not prepend with "https://". 1064 disable_verify_ssl: bool 1065 Your networking setup may be behind a firewall which performs SSL 1066 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1067 to point to the location of a custom certificate bundle, or set this 1068 parameter to true to disable SSL verification as a workaround. 1069 1070 Returns 1071 ------- 1072 dict: 1073 Dictionary containing meta-data about the dataset. 1074 1075 'created': <creation date>, 1076 'fileSize': <file size>, 1077 'id': <dataset ID>, 1078 'name': <dataset name>, 1079 'ownerId': <owner ID>, 1080 'region': <dataset region>, 1081 'status': {AVAILABLE|UPDATING|CREATING|ERROR}, 1082 'type': {STOCK|STRATEGY|GLOBAL}, 1083 'universeId': <universe ID>, 1084 'validFrom': [YYYY, MM, DD], 1085 'validTo': [YYYY, MM, DD]} 1086 1087 """ 1088 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1089 return client.query_dataset(dataset_id)
Queries the status, timerange of a dataset.
Returns meta-information about a dataset. This can be used to check the dateranges covered and the current status.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing meta-data about the dataset.
'created': <creation date>,
'fileSize': <file size>,
'id': <dataset ID>,
'name': <dataset name>,
'ownerId': <owner ID>,
'region': <dataset region>,
'status': {AVAILABLE|UPDATING|CREATING|ERROR},
'type': {STOCK|STRATEGY|GLOBAL},
'universeId': <universe ID>,
'validFrom': [YYYY, MM, DD],
'validTo': [YYYY, MM, DD]}
1092def getUniverse(apikey, model_id, date=None, proxy=None, disable_verify_ssl=False): 1093 """ 1094 Returns the universe members of a model. 1095 1096 Returns the members of the universe of a model. If no date is provided, 1097 effective date ranges will be returned. If a date is provided, only the 1098 universe members of that date are returned. The results are returned in a 1099 Pandas DataFrame. 1100 1101 For more information, see http://docs.insights.boosted.ai/universe-upload. 1102 1103 Parameters 1104 ---------- 1105 apikey: str 1106 API key provided by Boosted. This key should be protected as a secret. 1107 model_id: str 1108 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1109 button next to your model's name in the Model Summary Page in Boosted 1110 Insights. 1111 date: datetime.date or YYYY-MM-DD string 1112 Date of the universe to retrieve. 1113 proxy: str 1114 Your organization may require the use of a proxy for access. 1115 The address of a HTTPS proxy in the format of <address>:<port>. 1116 Examples are "123.456.789:123" or "my.proxy.com:123". 1117 Do not prepend with "https://". 1118 disable_verify_ssl: bool 1119 Your networking setup may be behind a firewall which performs SSL 1120 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1121 to point to the location of a custom certificate bundle, or set this 1122 parameter to true to disable SSL verification as a workaround. 1123 1124 Returns 1125 ------- 1126 pandas.DataFrame 1127 Pandas DataFrame containing the universe members. If a date was 1128 provided, only ISIN, Country, and Currency are returned. If no date 1129 was provided, returns From, To, ISIN, Country, Currency. 1130 """ 1131 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1132 return client.getUniverse(model_id, date)
Returns the universe members of a model.
Returns the members of the universe of a model. If no date is provided, effective date ranges will be returned. If a date is provided, only the universe members of that date are returned. The results are returned in a Pandas DataFrame.
For more information, see http://docs.insights.boosted.ai/universe-upload.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing the universe members. If a date was provided, only ISIN, Country, and Currency are returned. If no date was provided, returns From, To, ISIN, Country, Currency.
1135def updateUniverse( 1136 apikey, 1137 model_id, 1138 universe_df, 1139 date=datetime.date.today() + timedelta(1), 1140 proxy=None, 1141 disable_verify_ssl=False, 1142): 1143 """ 1144 Sets the universe members of a model. 1145 1146 Sets the members of the universe of a model. Universe members may only be 1147 set for future dates. 1148 1149 For more information, see http://docs.insights.boosted.ai/universe-upload. 1150 1151 Parameters 1152 ---------- 1153 apikey: str 1154 API key provided by Boosted. This key should be protected as a secret. 1155 model_id: str 1156 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1157 button next to your model's name in the Model Summary Page in Boosted 1158 Insights. 1159 universe_df: Pandas.DataFrame 1160 A Pandas.DataFrame with columns ISIN, Country, Currency. 1161 date: datetime.date or YYYY-MM-DD string 1162 Date of the universe to retrieve. 1163 proxy: str 1164 Your organization may require the use of a proxy for access. 1165 The address of a HTTPS proxy in the format of <address>:<port>. 1166 Examples are "123.456.789:123" or "my.proxy.com:123". 1167 Do not prepend with "https://". 1168 disable_verify_ssl: bool 1169 Your networking setup may be behind a firewall which performs SSL 1170 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1171 to point to the location of a custom certificate bundle, or set this 1172 parameter to true to disable SSL verification as a workaround. 1173 1174 Returns 1175 ------- 1176 str 1177 Any warnings, e.g. failure to map ISINs, are returned. 1178 """ 1179 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1180 return client.updateUniverse(model_id, universe_df, date)
Sets the universe members of a model.
Sets the members of the universe of a model. Universe members may only be set for future dates.
For more information, see http://docs.insights.boosted.ai/universe-upload.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. universe_df: Pandas.DataFrame A Pandas.DataFrame with columns ISIN, Country, Currency. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Any warnings, e.g. failure to map ISINs, are returned.
1183def createUniverse( 1184 apikey: str, 1185 universe: Union[pd.DataFrame, str], 1186 name: str, 1187 description: Optional[str] = None, 1188 proxy=None, 1189 disable_verify_ssl=False, 1190) -> List[str]: 1191 """ 1192 Creates a new boosted security universe. 1193 1194 Columns in the universe (dataframe or csv file path) to identify the 1195 universe are isin and/or symbol, from, to, country, currency. 1196 1197 Note that either isin or symbol are required columns. 1198 1199 Rules for the universe data are identical to those on the web universe 1200 creation screen: 1201 - Make sure your CSV does not contain empty columns. 1202 - Date columns must be in YYYY-MM-DD format. 1203 - The "from" and "to" fields represent the date range for which a 1204 security will exist in the universe for. The keyword "PRESENT" can be used 1205 in place of the "to_date" field. If you wish to create a Live model, ensure that 1206 at least some securities have "PRESENT" as their "to_date" field. 1207 - If the "to_date" column is ommitted, securites will exist in the universe 1208 until "PRESENT" by default, if possible. 1209 - "from" will default to "the beginning of time" if unspecified, and 1210 "to" will default to "PRESENT" 1211 1212 - The keyword "ANY" can also be used in place of the country and currency 1213 fields. 1214 - Rows with "ANY" will select the optimal security based on other securities 1215 in the portfolio For Country and Currency, the prefix "P_" (i.e. "P_USA") 1216 means "preferred." The model will attempt to match the security to the 1217 preferred specification. 1218 - "country" and "currency" will default to "ANY" if the column was 1219 omitted. 1220 1221 Parameters 1222 ---------- 1223 apikey: str 1224 API key provided by Boosted. This key should be protected as a secret. 1225 universe: Union[Pandas.DataFrame, str] 1226 May be either a Pandas.DataFrame, or a path to a csv. 1227 name: str 1228 The name of the new universe. 1229 description: str 1230 Optional description of the new universe. 1231 proxy: str 1232 Your organization may require the use of a proxy for access. 1233 The address of a HTTPS proxy in the format of <address>:<port>. 1234 Examples are "123.456.789:123" or "my.proxy.com:123". 1235 Do not prepend with "https://". 1236 disable_verify_ssl: bool 1237 Your networking setup may be behind a firewall which performs SSL 1238 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1239 to point to the location of a custom certificate bundle, or set this 1240 parameter to true to disable SSL verification as a workaround. 1241 1242 Returns 1243 ------- 1244 List[str] 1245 List of any warnings, e.g. failure to map ISINs, are returned. Return 1246 empty list if no warnings are returned. 1247 """ 1248 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1249 description = "" if description is None else description 1250 return client.create_universe(universe, name, description)
Creates a new boosted security universe.
Columns in the universe (dataframe or csv file path) to identify the universe are isin and/or symbol, from, to, country, currency.
Note that either isin or symbol are required columns.
Rules for the universe data are identical to those on the web universe creation screen:
- Make sure your CSV does not contain empty columns.
- Date columns must be in YYYY-MM-DD format.
- The "from" and "to" fields represent the date range for which a security will exist in the universe for. The keyword "PRESENT" can be used in place of the "to_date" field. If you wish to create a Live model, ensure that at least some securities have "PRESENT" as their "to_date" field.
- If the "to_date" column is ommitted, securites will exist in the universe until "PRESENT" by default, if possible.
- "from" will default to "the beginning of time" if unspecified, and "to" will default to "PRESENT"
- The keyword "ANY" can also be used in place of the country and currency fields.
- Rows with "ANY" will select the optimal security based on other securities in the portfolio For Country and Currency, the prefix "P_" (i.e. "P_USA") means "preferred." The model will attempt to match the security to the preferred specification.
- "country" and "currency" will default to "ANY" if the column was omitted.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. universe: Union[Pandas.DataFrame, str] May be either a Pandas.DataFrame, or a path to a csv. name: str The name of the new universe. description: str Optional description of the new universe. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
List[str] List of any warnings, e.g. failure to map ISINs, are returned. Return empty list if no warnings are returned.
1253def getAllocationsForDate( 1254 apikey, 1255 portfolio_id, 1256 date=datetime.date.today(), 1257 rollback_to_last_available_date=False, 1258 proxy=None, 1259 disable_verify_ssl=False, 1260): 1261 """ 1262 Get the allocations for a portfolio on a date. 1263 1264 Parameters 1265 ---------- 1266 apikey: str 1267 API key provided by Boosted. This key should be protected as a secret. 1268 portfolio_id: str 1269 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1270 date: datetime.date or YYYY-MM-DD string 1271 Date of the universe to retrieve. 1272 rollback_to_last_available_date: bool 1273 Whether or not to retrieve rankings for the most recent date if the current date 1274 is not a trade date. 1275 proxy: str 1276 Your organization may require the use of a proxy for access. 1277 The address of a HTTPS proxy in the format of <address>:<port>. 1278 Examples are "123.456.789:123" or "my.proxy.com:123". 1279 Do not prepend with "https://". 1280 disable_verify_ssl: bool 1281 Your networking setup may be behind a firewall which performs SSL 1282 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1283 to point to the location of a custom certificate bundle, or set this 1284 parameter to true to disable SSL verification as a workaround. 1285 1286 Returns 1287 ------- 1288 dict: 1289 Dictionary containing allocation information: 1290 model_id: str 1291 - Model id from accompanying portfolio 1292 date: str 1293 - Date string in yyyy/mm/dd format of date of the allocation data 1294 allocations: List of dict 1295 - List of allocation information 1296 allocation: float 1297 - Allocation of security 1298 allocation_delta: float 1299 - Difference in allocation compared to previous trade 1300 company_name: str 1301 - Security name 1302 country: str 1303 - Security exchange region 1304 currency: str 1305 - Security currency 1306 has_trade_signal: bool 1307 - If trade was based on signal or outside reason 1308 isin: str 1309 - ISIN of security 1310 price: float 1311 - Price of security 1312 shares_owned: float 1313 - Current shares of the security 1314 shares_traded: float 1315 - Number of share traded of te security 1316 symbol: str 1317 - Symbol of the security 1318 """ 1319 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1320 return client.getAllocationsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the allocations for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing allocation information: model_id: str - Model id from accompanying portfolio date: str - Date string in yyyy/mm/dd format of date of the allocation data allocations: List of dict - List of allocation information allocation: float - Allocation of security allocation_delta: float - Difference in allocation compared to previous trade company_name: str - Security name country: str - Security exchange region currency: str - Security currency has_trade_signal: bool - If trade was based on signal or outside reason isin: str - ISIN of security price: float - Price of security shares_owned: float - Current shares of the security shares_traded: float - Number of share traded of te security symbol: str - Symbol of the security
1323def getAllocationsForDateV2( 1324 apikey, 1325 portfolio_id, 1326 date=datetime.date.today(), 1327 rollback_to_last_available_date=False, 1328 proxy=None, 1329 disable_verify_ssl=False, 1330): 1331 """ 1332 Get the allocations for a portfolio on a date. 1333 1334 Parameters 1335 ---------- 1336 apikey: str 1337 API key provided by Boosted. This key should be protected as a secret. 1338 portfolio_id: str 1339 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1340 date: datetime.date or YYYY-MM-DD string 1341 Date of the universe to retrieve. 1342 rollback_to_last_available_date: bool 1343 Whether or not to retrieve rankings for the most recent date if the current date 1344 is not a trade date. 1345 proxy: str 1346 Your organization may require the use of a proxy for access. 1347 The address of a HTTPS proxy in the format of <address>:<port>. 1348 Examples are "123.456.789:123" or "my.proxy.com:123". 1349 Do not prepend with "https://". 1350 disable_verify_ssl: bool 1351 Your networking setup may be behind a firewall which performs SSL 1352 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1353 to point to the location of a custom certificate bundle, or set this 1354 parameter to true to disable SSL verification as a workaround. 1355 1356 Returns 1357 ------- 1358 dict: 1359 Dictionary containing allocation information: 1360 model_id: str 1361 - Model id from accompanying portfolio 1362 date: str 1363 - Date string in yyyy/mm/dd format of date of the allocation data 1364 allocations: List of dict 1365 - List of allocation information 1366 allocation: float 1367 - Allocation of security 1368 allocation_delta: float 1369 - Difference in allocation compared to previous allocation 1370 company_name: str 1371 - Security name 1372 country: str 1373 - Security exchange region 1374 currency: str 1375 - Security currency 1376 has_trade_signal: bool 1377 - If trade was based on signal or outside reason 1378 isin: str 1379 - ISIN of security 1380 price: float 1381 - Price of security 1382 shares_owned: float 1383 - Current shares of the security 1384 shares_traded: float 1385 - Number of shares traded of te security 1386 symbol: str 1387 - Symbol of the security 1388 """ 1389 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1390 return client.getAllocationsForDateV2(portfolio_id, date, rollback_to_last_available_date)
Get the allocations for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing allocation information: model_id: str - Model id from accompanying portfolio date: str - Date string in yyyy/mm/dd format of date of the allocation data allocations: List of dict - List of allocation information allocation: float - Allocation of security allocation_delta: float - Difference in allocation compared to previous allocation company_name: str - Security name country: str - Security exchange region currency: str - Security currency has_trade_signal: bool - If trade was based on signal or outside reason isin: str - ISIN of security price: float - Price of security shares_owned: float - Current shares of the security shares_traded: float - Number of shares traded of te security symbol: str - Symbol of the security
1393def getAllocationsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1394 """ 1395 Get the allocations for a portfolio on all dates. 1396 1397 Parameters 1398 ---------- 1399 apikey: str 1400 API key provided by Boosted. This key should be protected as a secret. 1401 portfolio_id: str 1402 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1403 proxy: str 1404 Your organization may require the use of a proxy for access. 1405 The address of a HTTPS proxy in the format of <address>:<port>. 1406 Examples are "123.456.789:123" or "my.proxy.com:123". 1407 Do not prepend with "https://". 1408 disable_verify_ssl: bool 1409 Your networking setup may be behind a firewall which performs SSL 1410 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1411 to point to the location of a custom certificate bundle, or set this 1412 parameter to true to disable SSL verification as a workaround. 1413 1414 Returns 1415 ------- 1416 dict: 1417 Dictionary containing allocation information. 1418 model_id: str 1419 - Model id from accompanying portfolio 1420 allocations: dict 1421 keys: date of the allocations in the value 1422 value: list of dict 1423 - List of allocation information 1424 allocation: float 1425 - Allocation of security 1426 allocation_delta: float 1427 - Difference in allocation compared to previous trade 1428 company_name: str 1429 - Security name 1430 country: str 1431 - Security exchange region 1432 currency: str 1433 - Security currency 1434 has_trade_signal: bool 1435 - If trade was based on signal or outside reason 1436 isin: str 1437 - ISIN of security 1438 price: float 1439 - Price of security 1440 shares_owned: float 1441 - Current shares of the security 1442 shares_traded: float 1443 - Number of share traded of te security 1444 symbol: str 1445 - Symbol of the security 1446 """ 1447 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1448 return client.getAllocationsByDates(portfolio_id)
Get the allocations for a portfolio on all dates.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing allocation information. model_id: str - Model id from accompanying portfolio allocations: dict keys: date of the allocations in the value value: list of dict - List of allocation information allocation: float - Allocation of security allocation_delta: float - Difference in allocation compared to previous trade company_name: str - Security name country: str - Security exchange region currency: str - Security currency has_trade_signal: bool - If trade was based on signal or outside reason isin: str - ISIN of security price: float - Price of security shares_owned: float - Current shares of the security shares_traded: float - Number of share traded of te security symbol: str - Symbol of the security
1451def getSignalsForDate( 1452 apikey, 1453 portfolio_id, 1454 date=datetime.date.today(), 1455 rollback_to_last_available_date=False, 1456 proxy=None, 1457 disable_verify_ssl=False, 1458): 1459 """ 1460 Get the signals for a portfolio on a date. 1461 1462 Parameters 1463 ---------- 1464 apikey: str 1465 API key provided by Boosted. This key should be protected as a secret. 1466 portfolio_id: str 1467 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1468 date: datetime.date or YYYY-MM-DD string 1469 Date of the universe to retrieve. 1470 rollback_to_last_available_date: bool 1471 Whether or not to retrieve rankings for the most recent date if the current date 1472 is not a trade date. 1473 proxy: str 1474 Your organization may require the use of a proxy for access. 1475 The address of a HTTPS proxy in the format of <address>:<port>. 1476 Examples are "123.456.789:123" or "my.proxy.com:123". 1477 Do not prepend with "https://". 1478 disable_verify_ssl: bool 1479 Your networking setup may be behind a firewall which performs SSL 1480 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1481 to point to the location of a custom certificate bundle, or set this 1482 parameter to true to disable SSL verification as a workaround. 1483 1484 Returns 1485 ------- 1486 dict: 1487 Dictionary containing signals information: 1488 date: str 1489 - Date string in YYYY-MM-DD format of date of the signal data 1490 signals: List of dict 1491 - List of signal information per model 1492 model_id: str 1493 - Model id from accompanying portfolio 1494 signals_info: List of dict 1495 - Signal information for each security per model id 1496 company_name: str 1497 - Security name 1498 country: str 1499 - Security exchange region 1500 currency: str 1501 - Security currency 1502 date: str 1503 - Date of the signal data 1504 isin: str 1505 - ISIN of security 1506 signal: float 1507 - Signal from model 1508 signal_delta: float 1509 - Change in signal compared to last trade 1510 symbol: str 1511 - Symbol of the security 1512 """ 1513 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1514 return client.getSignalsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the signals for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing signals information: date: str - Date string in YYYY-MM-DD format of date of the signal data signals: List of dict - List of signal information per model model_id: str - Model id from accompanying portfolio signals_info: List of dict - Signal information for each security per model id company_name: str - Security name country: str - Security exchange region currency: str - Security currency date: str - Date of the signal data isin: str - ISIN of security signal: float - Signal from model signal_delta: float - Change in signal compared to last trade symbol: str - Symbol of the security
1517def getSignalsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1518 """ 1519 Get the signals for all dates in the portfolio. 1520 1521 Parameters 1522 ---------- 1523 apikey: str 1524 API key provided by Boosted. This key should be protected as a secret. 1525 portfolio_id: str 1526 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1527 proxy: str 1528 Your organization may require the use of a proxy for access. 1529 The address of a HTTPS proxy in the format of <address>:<port>. 1530 Examples are "123.456.789:123" or "my.proxy.com:123". 1531 Do not prepend with "https://". 1532 disable_verify_ssl: bool 1533 Your networking setup may be behind a firewall which performs SSL 1534 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1535 to point to the location of a custom certificate bundle, or set this 1536 parameter to true to disable SSL verification as a workaround. 1537 1538 Returns 1539 ------- 1540 dict: 1541 Dictionary containing signals information: 1542 model_id: str 1543 - Model id from accompanying portfolio 1544 signals: dict 1545 keys: date of the signals in the value 1546 value: list of dict 1547 - List of signal information per model 1548 signals_info: List of dict 1549 - Signal information for each security per model id 1550 company_name: str 1551 - Security name 1552 country: str 1553 - Security exchange region 1554 currency: str 1555 - Security currency 1556 date: str 1557 - Date string in YYYY-MM-DD format of date requested 1558 isin: str 1559 - ISIN of security 1560 signal: float 1561 - Signal from model 1562 signal_delta: float 1563 - Change in signal compared to last trade 1564 symbol: str 1565 - Symbol of the security 1566 """ 1567 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1568 return client.getSignalsForAllDates(portfolio_id)
Get the signals for all dates in the portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing signals information: model_id: str - Model id from accompanying portfolio signals: dict keys: date of the signals in the value value: list of dict - List of signal information per model signals_info: List of dict - Signal information for each security per model id company_name: str - Security name country: str - Security exchange region currency: str - Security currency date: str - Date string in YYYY-MM-DD format of date requested isin: str - ISIN of security signal: float - Signal from model signal_delta: float - Change in signal compared to last trade symbol: str - Symbol of the security
1571def getHistoricalTradeDates( 1572 apikey, portfolio_id, start_date=None, end_date=None, proxy=None, disable_verify_ssl=False 1573): 1574 """ 1575 Get the historical dates for which there exist trading data. 1576 1577 Parameters 1578 ---------- 1579 apikey: str 1580 API key provided by Boosted. This key should be protected as a secret. 1581 portfolio_id: str 1582 Portfolio ID. Portfolio IDs can be retrieved by clicking on the copy to clipboard 1583 button next to your portfolio's name in the Tear Sheet Page of a Model. 1584 start_date: datetime.date or YYYY-MM-DD string 1585 Starting date for the inclusive interval of dates to search. 1586 Defaults to 1 year prior to end date if unspecified. 1587 end_date: datetime.date or YYYY-MM-DD string 1588 Ending date for the inclusive interval of dates to search. 1589 Defaults to today if unspecified. 1590 proxy: str 1591 Your organization may require the use of a proxy for access. 1592 The address of a HTTPS proxy in the format of <address>:<port>. 1593 Examples are "123.456.789:123" or "my.proxy.com:123". 1594 Do not prepend with "https://". 1595 disable_verify_ssl: bool 1596 Your networking setup may be behind a firewall which performs SSL 1597 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1598 to point to the location of a custom certificate bundle, or set this 1599 parameter to true to disable SSL verification as a workaround. 1600 1601 Returns 1602 ------- 1603 dict: 1604 Dictionary containing date information 1605 dates: List of str 1606 List of historical trade dates in YYYY-MM-DD format. 1607 """ 1608 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1609 return client.getHistoricalTradeDates(portfolio_id, start_date, end_date)
Get the historical dates for which there exist trading data.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved by clicking on the copy to clipboard button next to your portfolio's name in the Tear Sheet Page of a Model. start_date: datetime.date or YYYY-MM-DD string Starting date for the inclusive interval of dates to search. Defaults to 1 year prior to end date if unspecified. end_date: datetime.date or YYYY-MM-DD string Ending date for the inclusive interval of dates to search. Defaults to today if unspecified. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing date information dates: List of str List of historical trade dates in YYYY-MM-DD format.
1612def getRankingsForDate( 1613 apikey, 1614 portfolio_id, 1615 date=datetime.date.today(), 1616 rollback_to_last_available_date=False, 1617 proxy=None, 1618 disable_verify_ssl=False, 1619): 1620 """ 1621 Get the rankings data for a portfolio on a date. 1622 1623 Parameters 1624 ---------- 1625 apikey: str 1626 API key provided by Boosted. This key should be protected as a secret. 1627 portfolio_id: str 1628 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1629 date: datetime.date or YYYY-MM-DD string 1630 Date of the universe to retrieve. 1631 rollback_to_last_available_date: bool 1632 Whether or not to retrieve rankings for the most recent date if the current date 1633 is not a trade date. 1634 proxy: str 1635 Your organization may require the use of a proxy for access. 1636 The address of a HTTPS proxy in the format of <address>:<port>. 1637 Examples are "123.456.789:123" or "my.proxy.com:123". 1638 Do not prepend with "https://". 1639 disable_verify_ssl: bool 1640 Your networking setup may be behind a firewall which performs SSL 1641 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1642 to point to the location of a custom certificate bundle, or set this 1643 parameter to true to disable SSL verification as a workaround. 1644 1645 Returns 1646 ------- 1647 Dictionary containing rankings information: 1648 model_id: str 1649 - Model id that the portfolio belongs to 1650 date: str 1651 - Date string in yyyy/mm/dd format of date of the ranking data 1652 rankings: List of dict 1653 - Rankings info per security in the portfolio 1654 symbol: str 1655 - Symbol of the security 1656 isin: str 1657 - The International Securities Identification Number of the security 1658 country: str 1659 - Three character country code 1660 currency: str 1661 - The currency short length code 1662 rank: int 1663 - the ranking from 1 (top) 1664 companyName: str 1665 - The name of the company who owns the security 1666 delta: int 1667 - The change in ranking from the last data point, first will be null 1668 """ 1669 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1670 return client.getRankingsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the rankings data for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve rankings for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary containing rankings information: model_id: str - Model id that the portfolio belongs to date: str - Date string in yyyy/mm/dd format of date of the ranking data rankings: List of dict - Rankings info per security in the portfolio symbol: str - Symbol of the security isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code rank: int - the ranking from 1 (top) companyName: str - The name of the company who owns the security delta: int - The change in ranking from the last data point, first will be null
1673def getRankingsForAllDates(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1674 """ 1675 Get all rankings data for a portfolio. 1676 1677 Parameters 1678 ---------- 1679 apikey: str 1680 API key provided by Boosted. This key should be protected as a secret. 1681 portfolio_id: str 1682 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1683 proxy: str 1684 Your organization may require the use of a proxy for access. 1685 The address of a HTTPS proxy in the format of <address>:<port>. 1686 Examples are "123.456.789:123" or "my.proxy.com:123". 1687 Do not prepend with "https://". 1688 disable_verify_ssl: bool 1689 Your networking setup may be behind a firewall which performs SSL 1690 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1691 to point to the location of a custom certificate bundle, or set this 1692 parameter to true to disable SSL verification as a workaround. 1693 1694 Returns 1695 ------- 1696 Dictionary containing rankings information: 1697 model_id: str 1698 - Model id that the portfolio belongs to 1699 rankings: dict 1700 keys: dates requested in yyyy/mm/dd format, model_id 1701 value: list of dict 1702 - Rankings info per security in the portfolio 1703 symbol: str 1704 - Symbol of the security 1705 isin: str 1706 - The International Securities Identification Number of the security 1707 country: str 1708 - Three character country code 1709 currency: str 1710 - The currency short length code 1711 rank: int 1712 - the ranking from 1 (top) 1713 companyName: str 1714 - The name of the company who owns the security 1715 delta: int 1716 - The change in ranking from the last data point, first will be null 1717 """ 1718 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1719 return client.getRankingsForAllDates(portfolio_id)
Get all rankings data for a portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary containing rankings information: model_id: str - Model id that the portfolio belongs to rankings: dict keys: dates requested in yyyy/mm/dd format, model_id value: list of dict - Rankings info per security in the portfolio symbol: str - Symbol of the security isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code rank: int - the ranking from 1 (top) companyName: str - The name of the company who owns the security delta: int - The change in ranking from the last data point, first will be null
1722def createSignalsModel( 1723 apikey, upload_data, model_name="SignalsUploadModel", proxy=None, disable_verify_ssl=False 1724): 1725 """ 1726 Create a new model with uploaded signals. The model may take a while to 1727 process asynchronously after this method returns. 1728 1729 Parameters 1730 ---------- 1731 apikey: str 1732 API key provided by Boosted. This key should be protected as a secret. 1733 upload_data: pandas.DataFrame 1734 Pandas DataFrame containing your data. The index must be 1735 DatetimeIndex. The first columns must be ISIN, Country, Currency by 1736 default. The remaining column must be the weight. 1737 model_name: str 1738 Name for this model. 1739 proxy: str 1740 Your organization may require the use of a proxy for access. 1741 The address of a HTTPS proxy in the format of <address>:<port>. 1742 Examples are "123.456.789:123" or "my.proxy.com:123". 1743 Do not prepend with "https://". 1744 disable_verify_ssl: bool 1745 Your networking setup may be behind a firewall which performs SSL 1746 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1747 to point to the location of a custom certificate bundle, or set this 1748 parameter to true to disable SSL verification as a workaround. 1749 1750 Returns 1751 ------- 1752 2-tuple 1753 str 1754 Model ID of the newly created model with uploaded signals. 1755 list of str 1756 Warnings incurred while uploading the allocations data. 1757 """ 1758 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1759 return client.createSignalsModel(upload_data, model_name)
Create a new model with uploaded signals. The model may take a while to process asynchronously after this method returns.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. upload_data: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. The remaining column must be the weight. model_name: str Name for this model. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
2-tuple str Model ID of the newly created model with uploaded signals. list of str Warnings incurred while uploading the allocations data.
1762def addSignalsToUploadedModel( 1763 apikey, 1764 model_id, 1765 upload_data, 1766 proxy=None, 1767 disable_verify_ssl=False, 1768 recalc_all=False, 1769 recalc_portfolio_ids=None, 1770): 1771 """ 1772 Add allocations to a previously created uploaded model, then update the most recently accessed 1773 portfolio in the model, or update based on the recalc_all/recalc_portfolio_ids parameters. 1774 The model may take a while to process asynchronously after this method returns. 1775 1776 Parameters 1777 ---------- 1778 apikey: str 1779 API key provided by Boosted. This key should be protected as a secret. 1780 model_id: str 1781 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1782 button next to your model's name in the Model Summary Page in Boosted 1783 Insights. 1784 upload_data: pandas.DataFrame 1785 Pandas DataFrame containing your data. The index must be 1786 DatetimeIndex. The first columns must be ISIN, Country, Currency by 1787 default. The remaining column must be the weight. 1788 proxy: str 1789 Your organization may require the use of a proxy for access. 1790 The address of a HTTPS proxy in the format of <address>:<port>. 1791 Examples are "123.456.789:123" or "my.proxy.com:123". 1792 Do not prepend with "https://". 1793 disable_verify_ssl: bool 1794 Your networking setup may be behind a firewall which performs SSL 1795 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1796 to point to the location of a custom certificate bundle, or set this 1797 parameter to true to disable SSL verification as a workaround. 1798 recalc_all: bool 1799 Set to True to recalculate all portfolios under the model after uploading the allocations. 1800 Otherwise if not set to True, the most recently-accessed portfolio in the model is updated, 1801 or if provided, the list of portfolios provided in recalc_portfolio_ids will be updated. 1802 recalc_portfolio_ids: List[str] 1803 Specify a list of portfolio IDs to recalculate after uploading the allocations. 1804 Portfolio IDs can be retrieved from portfolio's configuration page. 1805 1806 Returns 1807 ------- 1808 list of str 1809 Warnings incurred while uploading the allocations data. 1810 """ 1811 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1812 return client.addSignalsToUploadedModel( 1813 model_id, upload_data, recalc_all=recalc_all, recalc_portfolio_ids=recalc_portfolio_ids 1814 )
Add allocations to a previously created uploaded model, then update the most recently accessed portfolio in the model, or update based on the recalc_all/recalc_portfolio_ids parameters. The model may take a while to process asynchronously after this method returns.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. upload_data: pandas.DataFrame Pandas DataFrame containing your data. The index must be DatetimeIndex. The first columns must be ISIN, Country, Currency by default. The remaining column must be the weight. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
list of str Warnings incurred while uploading the allocations data.
1817def getSignalsFromUploadedModelForDate( 1818 apikey, model_id, date=datetime.date.today(), proxy=None, disable_verify_ssl=False 1819): 1820 """ 1821 Retrieve uploaded signal information for a uploaded model for one date. 1822 1823 Parameters 1824 ---------- 1825 apikey: str 1826 API key provided by Boosted. This key should be protected as a secret. 1827 model_id: str 1828 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1829 button next to your model's name in the Model Summary Page in Boosted 1830 Insights. 1831 date: datetime.date or YYYY-MM-DD string 1832 Date of the universe to retrieve. 1833 proxy: str 1834 Your organization may require the use of a proxy for access. 1835 The address of a HTTPS proxy in the format of <address>:<port>. 1836 Examples are "123.456.789:123" or "my.proxy.com:123". 1837 Do not prepend with "https://". 1838 disable_verify_ssl: bool 1839 Your networking setup may be behind a firewall which performs SSL 1840 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1841 to point to the location of a custom certificate bundle, or set this 1842 parameter to true to disable SSL verification as a workaround. 1843 1844 Returns 1845 ------- 1846 List of signal information 1847 date: str 1848 - Date string in yyyy/mm/dd format of date requested 1849 isin: str 1850 - The International Securities Identification Number of the security 1851 country: str 1852 - Three character country code 1853 currency: str 1854 - The currency short length code 1855 weight: float 1856 - signal value 1857 """ 1858 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1859 return client.getSignalsFromUploadedModel(model_id, date)
Retrieve uploaded signal information for a uploaded model for one date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the universe to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
List of signal information date: str - Date string in yyyy/mm/dd format of date requested isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code weight: float - signal value
1862def getSignalsFromUploadedModelForAllDates(apikey, model_id, proxy=None, disable_verify_ssl=False): 1863 """ 1864 Retrieve uploaded signal information for a uploaded model for all dates. 1865 1866 Parameters 1867 ---------- 1868 apikey: str 1869 API key provided by Boosted. This key should be protected as a secret. 1870 model_id: str 1871 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1872 button next to your model's name in the Model Summary Page in Boosted 1873 Insights. 1874 proxy: str 1875 Your organization may require the use of a proxy for access. 1876 The address of a HTTPS proxy in the format of <address>:<port>. 1877 Examples are "123.456.789:123" or "my.proxy.com:123". 1878 Do not prepend with "https://". 1879 disable_verify_ssl: bool 1880 Your networking setup may be behind a firewall which performs SSL 1881 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1882 to point to the location of a custom certificate bundle, or set this 1883 parameter to true to disable SSL verification as a workaround. 1884 1885 Returns 1886 ------- 1887 List of signal information 1888 date: str 1889 - Date string in yyyy/mm/dd format of date requested 1890 isin: str 1891 - The International Securities Identification Number of the security 1892 country: str 1893 - Three character country code 1894 currency: str 1895 - The currency short length code 1896 weight: float 1897 - signal value 1898 """ 1899 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1900 return client.getSignalsFromUploadedModel(model_id)
Retrieve uploaded signal information for a uploaded model for all dates.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
List of signal information date: str - Date string in yyyy/mm/dd format of date requested isin: str - The International Securities Identification Number of the security country: str - Three character country code currency: str - The currency short length code weight: float - signal value
1903def createPortfolioWithPortfolioSettings( 1904 apikey, 1905 model_id, 1906 portfolio_name, 1907 portfolio_description, 1908 portfolio_settings, 1909 proxy=None, 1910 disable_verify_ssl=False, 1911): 1912 """ 1913 Create a portfolio for a model, based on provided portfolio settings. 1914 Specific portfolio settings will fall back to defaults if not provided, and 1915 no two portfolios on the same model may have the exact same set of settings. 1916 Unspecified portfolio settings keys will be defaulted to their model default values. 1917 The portfolio will be asynchronously processed/recalculated and will be available within 1918 5-10 minutes. 1919 1920 Parameters 1921 ---------- 1922 apikey: str 1923 API key provided by Boosted. This key should be protected as a secret. 1924 model_id: str 1925 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 1926 button next to your model's name in the Model Summary Page in Boosted 1927 Insights. 1928 portfolio_name: str 1929 Name of the new portfolio. Must be <= 20 characters. 1930 portfolio_description: str 1931 Description for the new portfolio. Must be <= 100 characters. 1932 portfolio_settings: boosted.api.api_type.PortfolioSettings 1933 A pre-configured PortfolioSettings dict. 1934 proxy: str 1935 Your organization may require the use of a proxy for access. 1936 The address of a HTTPS proxy in the format of <address>:<port>. 1937 Examples are "123.456.789:123" or "my.proxy.com:123". 1938 Do not prepend with "https://". 1939 disable_verify_ssl: bool 1940 Your networking setup may be behind a firewall which performs SSL 1941 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1942 to point to the location of a custom certificate bundle, or set this 1943 parameter to true to disable SSL verification as a workaround. 1944 1945 Returns 1946 ------- 1947 str 1948 Portfolio ID of the newly created portfolio. 1949 """ 1950 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1951 return client.createPortfolioWithPortfolioSettings( 1952 model_id, portfolio_name, portfolio_description, portfolio_settings 1953 )
Create a portfolio for a model, based on provided portfolio settings. Specific portfolio settings will fall back to defaults if not provided, and no two portfolios on the same model may have the exact same set of settings. Unspecified portfolio settings keys will be defaulted to their model default values. The portfolio will be asynchronously processed/recalculated and will be available within 5-10 minutes.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_name: str Name of the new portfolio. Must be <= 20 characters. portfolio_description: str Description for the new portfolio. Must be <= 100 characters. portfolio_settings: boosted.api.api_type.PortfolioSettings A pre-configured PortfolioSettings dict. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
str Portfolio ID of the newly created portfolio.
1956def getPortfolioSettings(apikey, portfolio_id, proxy=None, disable_verify_ssl=False): 1957 """ 1958 Retrieve portfolio settings from an existing portfolio. The result can be modified and 1959 reused to create a new portfolio. The set of returned portfolio settings are limited 1960 to a view of ones editable as documented in `boosted.api.api_type.PortfolioSettings` only. 1961 1962 Parameters 1963 ---------- 1964 apikey: str 1965 API key provided by Boosted. This key should be protected as a secret. 1966 portfolio_id: str 1967 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 1968 proxy: str 1969 Your organization may require the use of a proxy for access. 1970 The address of a HTTPS proxy in the format of <address>:<port>. 1971 Examples are "123.456.789:123" or "my.proxy.com:123". 1972 Do not prepend with "https://". 1973 disable_verify_ssl: bool 1974 Your networking setup may be behind a firewall which performs SSL 1975 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 1976 to point to the location of a custom certificate bundle, or set this 1977 parameter to true to disable SSL verification as a workaround. 1978 1979 Returns 1980 ------- 1981 boosted.api.api_type.PortfolioSettings 1982 A PortfolioSettings can be used to create a new portfolio. 1983 """ 1984 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 1985 return client.getPortfolioSettings(portfolio_id)
Retrieve portfolio settings from an existing portfolio. The result can be modified and
reused to create a new portfolio. The set of returned portfolio settings are limited
to a view of ones editable as documented in boosted.api.api_type.PortfolioSettings
only.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
boosted.api.api_type.PortfolioSettings A PortfolioSettings can be used to create a new portfolio.
1988def getGbiIdFromIsinCountryCurrencyDate( 1989 apikey, isin_country_currency_dates, proxy=None, disable_verify_ssl=False 1990): 1991 """ 1992 Get the gbi securities from a isin, country, currency, date combinations 1993 1994 Parameters 1995 ---------- 1996 apikey: str 1997 API key provided by Boosted. This key should be protected as a secret. 1998 isin_country_currency_dates: list of IsinCountryCurrencyDate 1999 An array of IsinCountryCurrencyDate 2000 proxy: str 2001 Your organization may require the use of a proxy for access. 2002 The address of a HTTPS proxy in the format of <address>:<port>. 2003 Examples are "123.456.789:123" or "my.proxy.com:123". 2004 Do not prepend with "https://". 2005 disable_verify_ssl: bool 2006 Your networking setup may be behind a firewall which performs SSL 2007 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2008 to point to the location of a custom certificate bundle, or set this 2009 parameter to true to disable SSL verification as a workaround. 2010 2011 Returns 2012 ------- 2013 list of GbiIdSecurity 2014 The corresponding gbi id securities 2015 """ 2016 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2017 return client.getGbiIdFromIsinCountryCurrencyDate(isin_country_currency_dates)
Get the gbi securities from a isin, country, currency, date combinations
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin_country_currency_dates: list of IsinCountryCurrencyDate An array of IsinCountryCurrencyDate proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
list of GbiIdSecurity The corresponding gbi id securities
2020def getDatasetDates(apikey, dataset_id, proxy=None, disable_verify_ssl=False): 2021 """ 2022 Gets the valid to and valid from dates of the given dataset id 2023 2024 Parameters 2025 ---------- 2026 apikey: str 2027 API key provided by Boosted. This key should be protected as a secret. 2028 dataset_id: str 2029 Dataset ID. Can be from the output of addDependentDataset or be found 2030 in your Custom Data listing in Boosted Insights. 2031 proxy: str 2032 Your organization may require the use of a proxy for access. 2033 The address of a HTTPS proxy in the format of <address>:<port>. 2034 Examples are "123.456.789:123" or "my.proxy.com:123". 2035 Do not prepend with "https://". 2036 disable_verify_ssl: bool 2037 Your networking setup may be behind a firewall which performs SSL 2038 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2039 to point to the location of a custom certificate bundle, or set this 2040 parameter to true to disable SSL verification as a workaround. 2041 2042 Returns 2043 ------- 2044 dict: 2045 Dictionary containing the valid to and from dates of the dataset 2046 { 2047 'validFrom': datetime.date, 2048 'validTo': datetime.date 2049 } 2050 ___ 2051 """ 2052 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2053 return client.getDatasetDates(dataset_id)
Gets the valid to and valid from dates of the given dataset id
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. dataset_id: str Dataset ID. Can be from the output of addDependentDataset or be found in your Custom Data listing in Boosted Insights. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing the valid to and from dates of the dataset { 'validFrom': datetime.date, 'validTo': datetime.date }
2056def getRankingAnalysis(apikey, model_id, date, proxy=None, disable_verify_ssl=False): 2057 """ 2058 Gets the ranking 2.0 analysis data for the given model on the given date 2059 2060 Parameters 2061 ---------- 2062 apikey: str 2063 API key provided by Boosted. This key should be protected as a secret. 2064 model_id: str 2065 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2066 button next to your model's name in the Model Summary Page in Boosted 2067 Insights. 2068 date: datetime.date or YYYY-MM-DD string 2069 Date of the data to retrieve. 2070 proxy: str 2071 Your organization may require the use of a proxy for access. 2072 The address of a HTTPS proxy in the format of <address>:<port>. 2073 Examples are "123.456.789:123" or "my.proxy.com:123". 2074 Do not prepend with "https://". 2075 disable_verify_ssl: bool 2076 Your networking setup may be behind a firewall which performs SSL 2077 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2078 to point to the location of a custom certificate bundle, or set this 2079 parameter to true to disable SSL verification as a workaround. 2080 2081 Returns 2082 ------- 2083 pandas.DataFrame 2084 Pandas DataFrame containing your data indexed by data buckets and feature names. 2085 ___ 2086 """ 2087 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2088 return client.getRankingAnalysis(model_id, date)
Gets the ranking 2.0 analysis data for the given model on the given date
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data indexed by data buckets and feature names.
2091def getRankingExplain( 2092 apikey, 2093 model_id, 2094 date, 2095 proxy=None, 2096 disable_verify_ssl=False, 2097 index_by_symbol: bool = False, 2098 index_by_all_metadata: bool = False, 2099): 2100 """ 2101 Gets the ranking 2.0 explain data for the given model on the given date 2102 2103 Parameters 2104 ---------- 2105 apikey: str 2106 API key provided by Boosted. This key should be protected as a secret. 2107 model_id: str 2108 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2109 button next to your model's name in the Model Summary Page in Boosted 2110 Insights. 2111 date: datetime.date or YYYY-MM-DD string 2112 Date of the data to retrieve. 2113 proxy: str 2114 Your organization may require the use of a proxy for access. 2115 The address of a HTTPS proxy in the format of <address>:<port>. 2116 Examples are "123.456.789:123" or "my.proxy.com:123". 2117 Do not prepend with "https://". 2118 disable_verify_ssl: bool 2119 Your networking setup may be behind a firewall which performs SSL 2120 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2121 to point to the location of a custom certificate bundle, or set this 2122 parameter to true to disable SSL verification as a workaround. 2123 index_by_symbol: bool 2124 If true, index by stock symbol instead of ISIN. 2125 index_by_all_metadata: bool 2126 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2127 Overrides index_by_symbol. 2128 2129 Returns 2130 ------- 2131 pandas.DataFrame 2132 Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata 2133 and feature names. 2134 ___ 2135 """ 2136 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2137 return client.getRankingExplain( 2138 model_id, date, index_by_symbol=index_by_symbol, index_by_all_metadata=index_by_all_metadata 2139 )
Gets the ranking 2.0 explain data for the given model on the given date
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata and feature names.
2142def getExplainForPortfolio( 2143 apikey, 2144 model_id, 2145 portfolio_id, 2146 date, 2147 proxy=None, 2148 disable_verify_ssl=False, 2149 index_by_symbol: bool = False, 2150 index_by_all_metadata: bool = False, 2151): 2152 """ 2153 Gets the ranking 2.0 explain data for the given model on the given date, 2154 filtered by portfolio. 2155 2156 Parameters 2157 ---------- 2158 apikey: str 2159 API key provided by Boosted. This key should be protected as a secret. 2160 model_id: str 2161 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2162 button next to your model's name in the Model Summary Page in Boosted 2163 Insights. 2164 portfolio_id: str 2165 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2166 date: datetime.date or YYYY-MM-DD string 2167 Date of the data to retrieve. 2168 proxy: str 2169 Your organization may require the use of a proxy for access. 2170 The address of a HTTPS proxy in the format of <address>:<port>. 2171 Examples are "123.456.789:123" or "my.proxy.com:123". 2172 Do not prepend with "https://". 2173 disable_verify_ssl: bool 2174 Your networking setup may be behind a firewall which performs SSL 2175 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2176 to point to the location of a custom certificate bundle, or set this 2177 parameter to true to disable SSL verification as a workaround. 2178 index_by_symbol: bool 2179 If true, index by stock symbol instead of ISIN. 2180 index_by_all_metadata: bool 2181 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2182 Overrides index_by_symbol. 2183 2184 Returns 2185 ------- 2186 pandas.DataFrame 2187 Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata 2188 and feature names, filtered by portfolio. 2189 ___ 2190 """ 2191 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2192 return client.getExplainForPortfolio( 2193 model_id, 2194 portfolio_id, 2195 date, 2196 index_by_symbol=index_by_symbol, 2197 index_by_all_metadata=index_by_all_metadata, 2198 )
Gets the ranking 2.0 explain data for the given model on the given date, filtered by portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing your data indexed by ISINs/Symbol/all metadata and feature names, filtered by portfolio.
2201def getDenseSignalsForDate( 2202 apikey, 2203 portfolio_id, 2204 date=datetime.date.today(), 2205 rollback_to_last_available_date=False, 2206 proxy=None, 2207 disable_verify_ssl=False, 2208): 2209 """ 2210 Get the dense signals for a portfolio on a date. 2211 2212 Parameters 2213 ---------- 2214 apikey: str 2215 API key provided by Boosted. This key should be protected as a secret. 2216 portfolio_id: str 2217 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2218 date: datetime.date or YYYY-MM-DD string 2219 Date of the signals to retrieve. 2220 rollback_to_last_available_date: bool 2221 Whether or not to retrieve signals for the most recent date if the current date 2222 is not a trade date. 2223 proxy: str 2224 Your organization may require the use of a proxy for access. 2225 The address of a HTTPS proxy in the format of <address>:<port>. 2226 Examples are "123.456.789:123" or "my.proxy.com:123". 2227 Do not prepend with "https://". 2228 disable_verify_ssl: bool 2229 Your networking setup may be behind a firewall which performs SSL 2230 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2231 to point to the location of a custom certificate bundle, or set this 2232 parameter to true to disable SSL verification as a workaround. 2233 2234 Returns 2235 ------- 2236 dict: 2237 Dictionary containing signals information: 2238 date: str 2239 - Date string in YYYY-MM-DD format of date of the signal data 2240 signals: List of dict 2241 - List of signal information per model 2242 model_id: str 2243 - Model id from accompanying portfolio 2244 signals_info: List of dict 2245 - Signal information for each security per model id 2246 allocation: float 2247 - Allocation in the portfolio 2248 company_name: str 2249 - Security name 2250 country: str 2251 - Security exchange region 2252 currency: str 2253 - Security currency 2254 date: str 2255 - Date of the signal data 2256 isin: str 2257 - ISIN of security 2258 quantile: int 2259 - Quantile from 1 to 5 2260 scaled_signal: float 2261 - Scaled signal 2262 signal: float 2263 - Signal from model 2264 symbol: str 2265 - Symbol of the security 2266 """ 2267 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2268 return client.getDenseSignalsForDate(portfolio_id, date, rollback_to_last_available_date)
Get the dense signals for a portfolio on a date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the signals to retrieve. rollback_to_last_available_date: bool Whether or not to retrieve signals for the most recent date if the current date is not a trade date. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary containing signals information: date: str - Date string in YYYY-MM-DD format of date of the signal data signals: List of dict - List of signal information per model model_id: str - Model id from accompanying portfolio signals_info: List of dict - Signal information for each security per model id allocation: float - Allocation in the portfolio company_name: str - Security name country: str - Security exchange region currency: str - Security currency date: str - Date of the signal data isin: str - ISIN of security quantile: int - Quantile from 1 to 5 scaled_signal: float - Scaled signal signal: float - Signal from model symbol: str - Symbol of the security
2271def getDenseSignals( 2272 apikey, 2273 model_id, 2274 portfolio_id, 2275 file_name=None, 2276 location="./", 2277 proxy=None, 2278 disable_verify_ssl=False, 2279): 2280 """ 2281 Downloads the dense signal csv for the provided portfolio and model 2282 2283 Parameters 2284 ---------- 2285 apikey: str 2286 API key provided by Boosted. This key should be protected as a secret. 2287 model_id: str 2288 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2289 button next to your model's name in the Model Summary Page in Boosted 2290 Insights. 2291 portfolio_id: str 2292 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2293 file_name: str 2294 File name of the dense signals file to save as. 2295 If no file name is given the file name will be "<model_id>-<portfolio_id>_dense_signals.csv" 2296 location: str 2297 The location to save the file to. 2298 If no location is given then it will be saved to the current directory. 2299 proxy: str 2300 Your organization may require the use of a proxy for access. 2301 The address of a HTTPS proxy in the format of <address>:<port>. 2302 Examples are "123.456.789:123" or "my.proxy.com:123". 2303 Do not prepend with "https://". 2304 disable_verify_ssl: bool 2305 Your networking setup may be behind a firewall which performs SSL 2306 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2307 to point to the location of a custom certificate bundle, or set this 2308 parameter to true to disable SSL verification as a workaround. 2309 2310 Returns 2311 ------- 2312 None 2313 ___ 2314 """ 2315 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2316 return client.getDenseSignals(model_id, portfolio_id, file_name, location)
Downloads the dense signal csv for the provided portfolio and model
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
model_id: str
Model ID. Model IDs can be retrieved by clicking on the copy to clipboard
button next to your model's name in the Model Summary Page in Boosted
Insights.
portfolio_id: str
Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page.
file_name: str
File name of the dense signals file to save as.
If no file name is given the file name will be "
Returns
None
2319def getRanking2DateAnalysisFile( 2320 apikey, 2321 model_id, 2322 portfolio_id, 2323 date, 2324 file_name=None, 2325 location="./", 2326 proxy=None, 2327 disable_verify_ssl=False, 2328): 2329 """ 2330 Downloads the ranking analysis file for the provied portfolio and model. 2331 If no file exist then it will send a request to generate the file and continuously 2332 poll the server every 5 seconds to try and download the file until the file is downloaded. 2333 2334 Parameters 2335 ---------- 2336 apikey: str 2337 API key provided by Boosted. This key should be protected as a secret. 2338 model_id: str 2339 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2340 button next to your model's name in the Model Summary Page in Boosted 2341 Insights. 2342 portfolio_id: str 2343 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2344 date: datetime.date or YYYY-MM-DD string 2345 Date of the data to retrieve. 2346 file_name: str 2347 File name of the dense signals file to save as. 2348 If no file name is given the file name will be 2349 "<model_id>-<portfolio_id>_statistical_analysis_<date>.xlsx" 2350 location: str 2351 The location to save the file to. 2352 If no location is given then it will be saved to the current directory. 2353 proxy: str 2354 Your organization may require the use of a proxy for access. 2355 The address of a HTTPS proxy in the format of <address>:<port>. 2356 Examples are "123.456.789:123" or "my.proxy.com:123". 2357 Do not prepend with "https://". 2358 disable_verify_ssl: bool 2359 Your networking setup may be behind a firewall which performs SSL 2360 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2361 to point to the location of a custom certificate bundle, or set this 2362 parameter to true to disable SSL verification as a workaround. 2363 2364 Returns 2365 ------- 2366 None 2367 ___ 2368 """ 2369 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2370 return client.getRanking2DateAnalysisFile(model_id, portfolio_id, date, file_name, location)
Downloads the ranking analysis file for the provied portfolio and model. If no file exist then it will send a request to generate the file and continuously poll the server every 5 seconds to try and download the file until the file is downloaded.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
model_id: str
Model ID. Model IDs can be retrieved by clicking on the copy to clipboard
button next to your model's name in the Model Summary Page in Boosted
Insights.
portfolio_id: str
Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page.
date: datetime.date or YYYY-MM-DD string
Date of the data to retrieve.
file_name: str
File name of the dense signals file to save as.
If no file name is given the file name will be
"
Returns
None
2373def getRanking2DateExplainFile( 2374 apikey, 2375 model_id, 2376 portfolio_id, 2377 date, 2378 file_name=None, 2379 location="./", 2380 proxy=None, 2381 disable_verify_ssl=False, 2382 overwrite: bool = False, 2383 index_by_all_metadata: bool = False, 2384): 2385 """ 2386 Downloads the ranking explain file for the provided portfolio and model. 2387 If no file exist then it will send a request to generate the file and continuously 2388 poll the server every 5 seconds to try and download the file until the file is downloaded. 2389 2390 Parameters 2391 ---------- 2392 apikey: str 2393 API key provided by Boosted. This key should be protected as a secret. 2394 model_id: str 2395 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2396 button next to your model's name in the Model Summary Page in Boosted 2397 Insights. 2398 portfolio_id: str 2399 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2400 date: datetime.date or YYYY-MM-DD string 2401 Date of the data to retrieve. 2402 file_name: str 2403 File name of the dense signals file to save as. 2404 If no file name is given the file name will be 2405 "<model_id>-<portfolio_id>_explain_data_<date>.xlsx" 2406 location: str 2407 The location to save the file to. 2408 If no location is given then it will be saved to the current directory. 2409 proxy: str 2410 Your organization may require the use of a proxy for access. 2411 The address of a HTTPS proxy in the format of <address>:<port>. 2412 Examples are "123.456.789:123" or "my.proxy.com:123". 2413 Do not prepend with "https://". 2414 disable_verify_ssl: bool 2415 Your networking setup may be behind a firewall which performs SSL 2416 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2417 to point to the location of a custom certificate bundle, or set this 2418 parameter to true to disable SSL verification as a workaround. 2419 overwrite: bool 2420 Defaults to False, set to True to regenerate the file. 2421 index_by_all_metadata: bool 2422 If true, index by all metadata: ISIN, stock symbol, currency, and country. 2423 2424 2425 Returns 2426 ------- 2427 None 2428 ___ 2429 """ 2430 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2431 return client.getRanking2DateExplainFile( 2432 model_id, 2433 portfolio_id, 2434 date, 2435 file_name, 2436 location, 2437 overwrite, 2438 index_by_all_metadata, 2439 )
Downloads the ranking explain file for the provided portfolio and model. If no file exist then it will send a request to generate the file and continuously poll the server every 5 seconds to try and download the file until the file is downloaded.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
model_id: str
Model ID. Model IDs can be retrieved by clicking on the copy to clipboard
button next to your model's name in the Model Summary Page in Boosted
Insights.
portfolio_id: str
Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page.
date: datetime.date or YYYY-MM-DD string
Date of the data to retrieve.
file_name: str
File name of the dense signals file to save as.
If no file name is given the file name will be
"
Returns
None
2442def getRanking2DateExplain( 2443 apikey: str, 2444 model_id: str, 2445 portfolio_id: str, 2446 date: BoostedDate, 2447 overwrite: bool = False, 2448 proxy: Optional[str] = None, 2449 disable_verify_ssl: bool = False, 2450) -> Dict[str, pd.DataFrame]: 2451 """ 2452 Downloads the ranking explain file for the provied portfolio and model and 2453 loads it into a dict of pandas dataframes. If no file exists then it will 2454 send a request to generate the file and continuously poll the server every 5 2455 seconds to try and download the file until the file is downlodded. 2456 2457 Parameters 2458 ---------- 2459 apikey: str 2460 API key provided by Boosted. This key should be protected as a secret. 2461 model_id: str 2462 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2463 button next to your model's name in the Model Summary Page in Boosted 2464 Insights. 2465 portfolio_id: str 2466 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2467 date: datetime.date or YYYY-MM-DD string 2468 Date of the data to retrieve. 2469 overwrite: bool 2470 Defaults to False, set to True to regenerate the file. 2471 proxy: str 2472 Your organization may require the use of a proxy for access. 2473 The address of a HTTPS proxy in the format of <address>:<port>. 2474 Examples are "123.456.789:123" or "my.proxy.com:123". 2475 Do not prepend with "https://". 2476 disable_verify_ssl: bool 2477 Your networking setup may be behind a firewall which performs SSL 2478 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2479 to point to the location of a custom certificate bundle, or set this 2480 parameter to true to disable SSL verification as a workaround. 2481 2482 Returns 2483 ------- 2484 A dict with excel sheet names as keys, and Pandas dataframe, indexed by 2485 symbol, as values. 2486 ___ 2487 """ 2488 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2489 return client.getRanking2DateExplain(model_id, portfolio_id, convert_date(date), overwrite)
Downloads the ranking explain file for the provied portfolio and model and loads it into a dict of pandas dataframes. If no file exists then it will send a request to generate the file and continuously poll the server every 5 seconds to try and download the file until the file is downlodded.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date or YYYY-MM-DD string Date of the data to retrieve. overwrite: bool Defaults to False, set to True to regenerate the file. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dict with excel sheet names as keys, and Pandas dataframe, indexed by symbol, as values.
2492def getTearSheet( 2493 apikey, 2494 model_id, 2495 portfolio_id, 2496 proxy=None, 2497 disable_verify_ssl=False, 2498 start_date=None, 2499 end_date=None, 2500 block=False, 2501): 2502 """ 2503 Gets the model and portfolio's tear sheet and returns it as a list of tear sheet groups 2504 2505 Parameters 2506 ---------- 2507 apikey: str 2508 API key provided by Boosted. This key should be protected as a secret. 2509 model_id: str 2510 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2511 button next to your model's name in the Model Summary Page in Boosted 2512 Insights. 2513 portfolio_id: str 2514 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2515 start_date: str or None 2516 Start date for the range of data represented by the tear sheet (YYYY-MM-DD) 2517 end_date: str or None 2518 End date for the range of data represented by the tear sheet (YYYY-MM-DD) 2519 Must be None if and only if start_date is None 2520 block: bool 2521 Whether or not to wait for the data to be ready. No effect if dates are not 2522 provided 2523 Returns 2524 ------- 2525 List 2526 Each element in the list represents a group in the tearsheet. i.e Risk Adjusted Returns 2527 Each dictionary is made of member which is a list of dicts representing a tearsheet 2528 value and a group name which is the name of the group shown on screen. Each dict in 2529 the member array has value which is a floating point number, type which is either 2530 "number" or "precent" to determine if value is a raw number or a percentage value, 2531 and finally "name" which is the name shown on screen. 2532 [ 2533 { 2534 members: [ 2535 { 2536 "value": float, 2537 "type": str, 2538 "name": str 2539 }, 2540 ], 2541 group_name: str 2542 }, 2543 ] 2544 ___ 2545 """ 2546 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2547 return client.getTearSheet( 2548 model_id, portfolio_id, start_date=start_date, end_date=end_date, block=block 2549 )
Gets the model and portfolio's tear sheet and returns it as a list of tear sheet groups
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. start_date: str or None Start date for the range of data represented by the tear sheet (YYYY-MM-DD) end_date: str or None End date for the range of data represented by the tear sheet (YYYY-MM-DD) Must be None if and only if start_date is None block: bool Whether or not to wait for the data to be ready. No effect if dates are not provided
Returns
List Each element in the list represents a group in the tearsheet. i.e Risk Adjusted Returns Each dictionary is made of member which is a list of dicts representing a tearsheet value and a group name which is the name of the group shown on screen. Each dict in the member array has value which is a floating point number, type which is either "number" or "precent" to determine if value is a raw number or a percentage value, and finally "name" which is the name shown on screen. [ { members: [ { "value": float, "type": str, "name": str }, ], group_name: str }, ]
2552def getPortfolioStatus( 2553 apikey, 2554 model_id, 2555 portfolio_id, 2556 job_date, 2557 proxy=None, 2558 disable_verify_ssl=False, 2559): 2560 """ 2561 Gets the update status of a portfolio 2562 2563 Parameters 2564 ---------- 2565 model_id: str 2566 The id of the model the portfolio belongs to 2567 portfolio_id: str 2568 The id of the portfolio 2569 job_date: str 2570 The date in question, in YYYY-MM-DD format 2571 Returns 2572 ------- 2573 dict with properties 2574 is_complete: bool 2575 True if the calculation for the date has been completed 2576 last_update: str 2577 The most recent date with a completed calculation 2578 next_update: str 2579 The earliest date (in the future) with an incomplete calculation 2580 ___ 2581 """ 2582 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2583 return client.getPortfolioStatus(model_id, portfolio_id, job_date)
Gets the update status of a portfolio
Parameters
model_id: str The id of the model the portfolio belongs to portfolio_id: str The id of the portfolio job_date: str The date in question, in YYYY-MM-DD format
Returns
dict with properties is_complete: bool True if the calculation for the date has been completed last_update: str The most recent date with a completed calculation next_update: str The earliest date (in the future) with an incomplete calculation
2586def getBlacklist( 2587 apikey, 2588 blacklist_id, 2589 proxy=None, 2590 disable_verify_ssl=False, 2591): 2592 """ 2593 Gets blacklist with provided id. You must have access to the blacklist. 2594 2595 Parameters 2596 ---------- 2597 blacklist_id: int 2598 Blacklist ID. Blacklist ID can be found by running getBlacklists, or 2599 when you create a blacklist the ID of the created blacklist will be shown. 2600 2601 Returns 2602 ------- 2603 Blacklist 2604 ___ 2605 """ 2606 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2607 return client.getBlacklist(blacklist_id)
Gets blacklist with provided id. You must have access to the blacklist.
Parameters
blacklist_id: int Blacklist ID. Blacklist ID can be found by running getBlacklists, or when you create a blacklist the ID of the created blacklist will be shown.
Returns
Blacklist
2610def getBlacklists( 2611 apikey, 2612 model_id=None, 2613 company_id=None, 2614 last_N=None, 2615 proxy=None, 2616 disable_verify_ssl=False, 2617): 2618 """ 2619 Gets the list of blacklists with provided company_id or model_id. If last_N is provided, 2620 the list will return N most recently created blacklists. If no parameter is provided, 2621 the list of user company's blacklists will be returned. 2622 Note that when company_id is provided, blacklists will be returned if you have access 2623 to their model, if they are model specified. 2624 company_id and model_id cannot both be provided. 2625 2626 Parameters 2627 ---------- 2628 model_id: str 2629 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2630 button next to your model's name in the Model Summary Page in Boosted 2631 Insights. You must have access to the model. 2632 company_id: str 2633 Company ID. Used by administrators to access blacklists from the given company. 2634 last_N: int 2635 N most recently created blacklists to return 2636 2637 Returns 2638 ------- 2639 list of Blacklists 2640 ___ 2641 """ 2642 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2643 return client.getBlacklists(model_id=model_id, company_id=company_id, last_N=last_N)
Gets the list of blacklists with provided company_id or model_id. If last_N is provided, the list will return N most recently created blacklists. If no parameter is provided, the list of user company's blacklists will be returned. Note that when company_id is provided, blacklists will be returned if you have access to their model, if they are model specified. company_id and model_id cannot both be provided.
Parameters
model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. You must have access to the model. company_id: str Company ID. Used by administrators to access blacklists from the given company. last_N: int N most recently created blacklists to return
Returns
list of Blacklists
2646def createBlacklist( 2647 apikey, 2648 isin, 2649 long_short=2, 2650 start_date=datetime.date.today(), 2651 end_date="4000-01-01", 2652 model_id=None, 2653 proxy=None, 2654 disable_verify_ssl=False, 2655): 2656 """ 2657 Creates a blacklist with ISIN, long_short, start_date and end_date. If model_id is given, 2658 the blacklist will be set for the given model. long_short will default to 2, 2659 start_date will default to today, and end_date will default to 4000-01-01, 2660 unless they are provided. 2661 2662 Parameters 2663 ---------- 2664 isin: string 2665 ISIN of the blacklist to be created 2666 long_short: int 2667 -1: short blacklist only 1: long blacklist only 2: both 2668 start_date: string 2669 The created blacklist will take effect from start_date. 2670 end_date: string 2671 The created blacklist will take effect until end_date. 2672 model_id: str 2673 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2674 button next to your model's name in the Model Summary Page in Boosted 2675 Insights. You must have access to the model. 2676 2677 Returns 2678 ------- 2679 Blacklist 2680 ___ 2681 """ 2682 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2683 return client.createBlacklist( 2684 isin, long_short=long_short, start_date=start_date, end_date=end_date, model_id=model_id 2685 )
Creates a blacklist with ISIN, long_short, start_date and end_date. If model_id is given, the blacklist will be set for the given model. long_short will default to 2, start_date will default to today, and end_date will default to 4000-01-01, unless they are provided.
Parameters
isin: string ISIN of the blacklist to be created long_short: int -1: short blacklist only 1: long blacklist only 2: both start_date: string The created blacklist will take effect from start_date. end_date: string The created blacklist will take effect until end_date. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. You must have access to the model.
Returns
Blacklist
2688def createBlacklistsFromCSV(apikey, csv_name, proxy=None, disable_verify_ssl=False): 2689 """ 2690 Creates blacklists from a csv. CSV must have the following header: 2691 ModelID, ISIN, LongShort, StartDate, EndDate 2692 where StartDate and EndDate are in the form of YYYY-MM-DD 2693 For more information and default behaviours, please refer to createBlacklist. 2694 2695 Parameters 2696 ---------- 2697 csv_name: string 2698 Name of the csv containing blacklists. Csv must be located in the same directory. 2699 2700 Returns 2701 ------- 2702 Blacklists 2703 ___ 2704 """ 2705 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2706 return client.createBlacklistsFromCSV(csv_name)
Creates blacklists from a csv. CSV must have the following header: ModelID, ISIN, LongShort, StartDate, EndDate where StartDate and EndDate are in the form of YYYY-MM-DD For more information and default behaviours, please refer to createBlacklist.
Parameters
csv_name: string Name of the csv containing blacklists. Csv must be located in the same directory.
Returns
Blacklists
2709def updateBlacklist( 2710 apikey, 2711 blacklist_id, 2712 long_short=None, 2713 start_date=None, 2714 end_date=None, 2715 proxy=None, 2716 disable_verify_ssl=False, 2717): 2718 """ 2719 Updates the blacklist with given id. You must have access to the blacklist. 2720 long_short, start_date and end_date are all optional. 2721 2722 Parameters 2723 ---------- 2724 blacklist_id: int 2725 Blacklist ID. Blacklist ID can be found by running getBlacklists, 2726 or when you create a blacklist the ID of the created blacklist will be shown. 2727 long_short: int 2728 -1: short blacklist only 1: long blacklist only 2: both 2729 start_date: string 2730 The created blacklist will take effect from start_date. 2731 end_date: string 2732 The created blacklist will take effect until end_date. 2733 2734 Returns 2735 ------- 2736 Blacklist 2737 ___ 2738 """ 2739 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2740 return client.updateBlacklist( 2741 blacklist_id, long_short=long_short, start_date=start_date, end_date=end_date 2742 )
Updates the blacklist with given id. You must have access to the blacklist. long_short, start_date and end_date are all optional.
Parameters
blacklist_id: int Blacklist ID. Blacklist ID can be found by running getBlacklists, or when you create a blacklist the ID of the created blacklist will be shown. long_short: int -1: short blacklist only 1: long blacklist only 2: both start_date: string The created blacklist will take effect from start_date. end_date: string The created blacklist will take effect until end_date.
Returns
Blacklist
2745def deleteBlacklist( 2746 apikey, 2747 blacklist_id, 2748 proxy=None, 2749 disable_verify_ssl=False, 2750): 2751 """ 2752 Deletes the blacklist with given id. You must have access to the blacklist. 2753 2754 Parameters 2755 ---------- 2756 blacklist_id: int 2757 Blacklist ID. Blacklist ID can be found by running getBlacklists, 2758 or when you create a blacklist the ID of the created blacklist will be shown. 2759 2760 Returns 2761 ------- 2762 Boolean, denoting the success of deletion 2763 ___ 2764 """ 2765 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2766 return client.deleteBlacklist(blacklist_id)
Deletes the blacklist with given id. You must have access to the blacklist.
Parameters
blacklist_id: int Blacklist ID. Blacklist ID can be found by running getBlacklists, or when you create a blacklist the ID of the created blacklist will be shown.
Returns
Boolean, denoting the success of deletion
2769def getFeatureImportance(apikey, model_id, date, N=None, proxy=None, disable_verify_ssl=False): 2770 """ 2771 Gets the top N features for the given model sorted in descending order of importance 2772 2773 Parameters 2774 ---------- 2775 apikey: str 2776 API key provided by Boosted. This key should be protected as a secret. 2777 model_id: str 2778 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2779 button next to your model's name in the Model Summary Page in Boosted 2780 Insights. 2781 date: datetime.date or YYYY-MM-DD string 2782 Date for the period for which features should be fetched. The resulting features 2783 are fetched for the period the date falls into. E.g. if the date is 2021-11-21 for the 2784 annual model, the features will be provided for the period of 2021-01-01 - 2021-12-31. 2785 N: int 2786 Limit for the number of top features to be returned. If not provided, the entire list 2787 of features will be returned. 2788 proxy: str 2789 Your organization may require the use of a proxy for access. 2790 The address of a HTTPS proxy in the format of <address>:<port>. 2791 Examples are "123.456.789:123" or "my.proxy.com:123". 2792 Do not prepend with "https://". 2793 disable_verify_ssl: bool 2794 Your networking setup may be behind a firewall which performs SSL 2795 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2796 to point to the location of a custom certificate bundle, or set this 2797 parameter to true to disable SSL verification as a workaround. 2798 Returns 2799 ------- 2800 pandas.DataFrame 2801 Pandas DataFrame containing features and their importance 2802 ___ 2803 """ 2804 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2805 return client.getFeatureImportance(model_id, date, N)
Gets the top N features for the given model sorted in descending order of importance
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. date: datetime.date or YYYY-MM-DD string Date for the period for which features should be fetched. The resulting features are fetched for the period the date falls into. E.g. if the date is 2021-11-21 for the annual model, the features will be provided for the period of 2021-01-01 - 2021-12-31. N: int Limit for the number of top features to be returned. If not provided, the entire list of features will be returned. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pandas.DataFrame Pandas DataFrame containing features and their importance
2808def getAllModelNames( 2809 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2810) -> Dict[str, str]: 2811 """ 2812 Gets the model names for all models the user has access to. 2813 Parameters 2814 ---------- 2815 apikey: str 2816 API key provided by Boosted. This key should be protected as a secret. 2817 proxy: Optional[str] 2818 Your organization may require the use of a proxy for access. 2819 The address of a HTTPS proxy in the format of <address>:<port>. 2820 Examples are "123.456.789:123" or "my.proxy.com:123". 2821 Do not prepend with "https://". 2822 disable_verify_ssl: bool = False 2823 Your networking setup may be behind a firewall which performs SSL 2824 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2825 to point to the location of a custom certificate bundle, or set this 2826 parameter to true to disable SSL verification as a workaround. 2827 Returns 2828 ------- 2829 dict: 2830 Dictionary mapping model id to model name. 2831 """ 2832 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2833 return client.getAllModelNames()
Gets the model names for all models the user has access to.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: Optional[str] Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
dict: Dictionary mapping model id to model name.
2836def getAllModelDetails( 2837 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2838) -> Dict[str, Dict[str, Any]]: 2839 """ 2840 Gets the model name, model id, last update time, and associated portfolio 2841 ids for all models the user has access to. 2842 Parameters 2843 ---------- 2844 apikey: str 2845 API key provided by Boosted. This key should be protected as a secret. 2846 proxy: Optional[str] 2847 Your organization may require the use of a proxy for access. 2848 The address of a HTTPS proxy in the format of <address>:<port>. 2849 Examples are "123.456.789:123" or "my.proxy.com:123". 2850 Do not prepend with "https://". 2851 disable_verify_ssl: bool = False 2852 Your networking setup may be behind a firewall which performs SSL 2853 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2854 to point to the location of a custom certificate bundle, or set this 2855 parameter to true to disable SSL verification as a workaround. 2856 Returns 2857 ------- 2858 Dictionary keyed by model id mapping to nested dictionary with the following values: 2859 portfolios: List[Dict[str, str]] 2860 List of portfolio associated with the model. Each portfolio is a dict 2861 with keys "id" and "name". 2862 name: str 2863 Model name. 2864 last_updated: datetime 2865 Last updated time of the model. 2866 """ 2867 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2868 return client.getAllModelDetails()
Gets the model name, model id, last update time, and associated portfolio ids for all models the user has access to.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: Optional[str] Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary keyed by model id mapping to nested dictionary with the following values: portfolios: List[Dict[str, str]] List of portfolio associated with the model. Each portfolio is a dict with keys "id" and "name". name: str Model name. last_updated: datetime Last updated time of the model.
2871def getEquityAccuracy( 2872 apikey: str, 2873 model_id: str, 2874 portfolio_id: str, 2875 tickers: List[str], 2876 start_date: Optional[BoostedDate] = None, 2877 end_date: Optional[BoostedDate] = None, 2878 proxy: Optional[str] = None, 2879 disable_verify_ssl: bool = False, 2880) -> Dict[str, Dict[str, Any]]: 2881 """ 2882 Retrieves accuracy data for a given portfolio and list of tickers. 2883 Parameters 2884 ---------- 2885 apikey: str 2886 API key provided by Boosted. This key should be protected as a secret. 2887 model_id: str 2888 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 2889 button next to your model's name in the Model Summary Page in Boosted 2890 Insights. 2891 portfolio_id: str 2892 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 2893 tickers: List[str] 2894 List of tickers to get accuracy information with. 2895 start_date: Optional[datetime | string]: 2896 Optional start date for data. If not specified, will default to the 2897 start date of the portfolio. 2898 end_date: Optional[datetime | string]: 2899 Optional end date for data. If not specified, will default to the 2900 end date of the portfolio. 2901 proxy: Optional[str] 2902 Your organization may require the use of a proxy for access. 2903 The address of a HTTPS proxy in the format of <address>:<port>. 2904 Examples are "123.456.789:123" or "my.proxy.com:123". 2905 Do not prepend with "https://". 2906 disable_verify_ssl: bool = False 2907 Your networking setup may be behind a firewall which performs SSL 2908 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2909 to point to the location of a custom certificate bundle, or set this 2910 parameter to true to disable SSL verification as a workaround. 2911 Returns 2912 ------- 2913 Nested dictionary: 2914 { 2915 "ticker1": { 2916 "hit_rate_mean": pd.DataFrame, 2917 "hit_rate_median": pd.DataFrame, 2918 "excess_return_mean": pd.DataFrame, 2919 "excess_return_median": pd.DataFrame, 2920 "return": "Recalculate the portfolio to get raw returns", 2921 "excess_return": pd.DataFrame, 2922 }, 2923 "ticker2": { 2924 "hit_rate_mean": pd.DataFrame, 2925 "hit_rate_median": pd.DataFrame, 2926 "excess_return_mean": pd.DataFrame, 2927 "excess_return_median": pd.DataFrame, 2928 "return": pd.DataFrame, 2929 "excess_return": pd.DataFrame, 2930 }, 2931 ... 2932 } 2933 Each dataframe above has columns: 2934 1D, 5D, 1M, 3M, 6M, 1Y, 2Y 2935 And row indexes: 2936 Q1, Q2, Q3, Q4, Q5 2937 2938 Note that the value for 'return' may be a string instead of a dataframe in 2939 cases where the data is not currently available in the specified portfolio. 2940 """ 2941 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2942 return client.getEquityAccuracy(model_id, portfolio_id, tickers, start_date, end_date)
Retrieves accuracy data for a given portfolio and list of tickers.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. tickers: List[str] List of tickers to get accuracy information with. start_date: Optional[datetime | string]: Optional start date for data. If not specified, will default to the start date of the portfolio. end_date: Optional[datetime | string]: Optional end date for data. If not specified, will default to the end date of the portfolio. proxy: Optional[str] Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Nested dictionary: { "ticker1": { "hit_rate_mean": pd.DataFrame, "hit_rate_median": pd.DataFrame, "excess_return_mean": pd.DataFrame, "excess_return_median": pd.DataFrame, "return": "Recalculate the portfolio to get raw returns", "excess_return": pd.DataFrame, }, "ticker2": { "hit_rate_mean": pd.DataFrame, "hit_rate_median": pd.DataFrame, "excess_return_mean": pd.DataFrame, "excess_return_median": pd.DataFrame, "return": pd.DataFrame, "excess_return": pd.DataFrame, }, ... } Each dataframe above has columns: 1D, 5D, 1M, 3M, 6M, 1Y, 2Y And row indexes: Q1, Q2, Q3, Q4, Q5
Note that the value for 'return' may be a string instead of a dataframe in cases where the data is not currently available in the specified portfolio.
2945def getHedgeExperiments( 2946 apikey: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 2947) -> List[HedgeExperiment]: 2948 """ 2949 Get a list of all hedge experiments. 2950 Parameters 2951 ---------- 2952 apikey: str 2953 API key provided by Boosted. This key should be protected as a secret. 2954 proxy: str 2955 Your organization may require the use of a proxy for access. 2956 The address of a HTTPS proxy in the format of <address>:<port>. 2957 Examples are "123.456.789:123" or "my.proxy.com:123". 2958 Do not prepend with "https://". 2959 disable_verify_ssl: bool 2960 Your networking setup may be behind a firewall which performs SSL 2961 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2962 to point to the location of a custom certificate bundle, or set this 2963 parameter to true to disable SSL verification as a workaround. 2964 Returns 2965 ------- 2966 HedgeExperiment object 2967 Results of the hedge experiment. 2968 """ 2969 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 2970 return client.get_hedge_experiments()
Get a list of all hedge experiments.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment object Results of the hedge experiment.
2973def getHedgeExperimentDetails( 2974 apikey: str, 2975 experiment_id: str, 2976 proxy: Optional[str] = None, 2977 disable_verify_ssl: bool = False, 2978) -> HedgeExperimentDetails: 2979 """ 2980 Get the details of a specific hedge experiment, as a HedgeExperiement object 2981 Parameters 2982 ---------- 2983 apikey: str 2984 API key provided by Boosted. This key should be protected as a secret. 2985 experiment_id: str 2986 UUID corresponding to the hedge experiment in question. 2987 proxy: str 2988 Your organization may require the use of a proxy for access. 2989 The address of a HTTPS proxy in the format of <address>:<port>. 2990 Examples are "123.456.789:123" or "my.proxy.com:123". 2991 Do not prepend with "https://". 2992 disable_verify_ssl: bool 2993 Your networking setup may be behind a firewall which performs SSL 2994 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 2995 to point to the location of a custom certificate bundle, or set this 2996 parameter to true to disable SSL verification as a workaround. 2997 Returns 2998 ------- 2999 HedgeExperiment object 3000 Results of the hedge experiment. 3001 """ 3002 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3003 return client.get_hedge_experiment_details(experiment_id)
Get the details of a specific hedge experiment, as a HedgeExperiement object
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_id: str UUID corresponding to the hedge experiment in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment object Results of the hedge experiment.
3006def getPortfolioPerformance( 3007 apikey: str, 3008 portfolio_id: str, 3009 start_date: Optional[datetime.date] = None, 3010 end_date: Optional[datetime.date] = None, 3011 daily_returns: bool = False, 3012 proxy: Optional[str] = None, 3013 disable_verify_ssl: bool = False, 3014) -> pd.DataFrame: 3015 """ 3016 Get performance data for a portfolio. 3017 3018 Parameters 3019 ---------- 3020 apikey: str 3021 API key provided by Boosted. This key should be protected as a secret. 3022 portfolio_id: str 3023 UUID corresponding to the portfolio in question. 3024 proxy: str 3025 Your organization may require the use of a proxy for access. 3026 The address of a HTTPS proxy in the format of <address>:<port>. 3027 Examples are "123.456.789:123" or "my.proxy.com:123". 3028 Do not prepend with "https://". 3029 disable_verify_ssl: bool 3030 Your networking setup may be behind a firewall which performs SSL 3031 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3032 to point to the location of a custom certificate bundle, or set this 3033 parameter to true to disable SSL verification as a workaround. 3034 start_date: datetime.date 3035 Starting cutoff date to filter performance data 3036 end_date: datetime.date 3037 Ending cutoff date to filter performance data 3038 daily_returns: bool 3039 Flag indicating whether to add a new column with the daily return pct calculated 3040 3041 Returns 3042 ------- 3043 pd.DataFrame object 3044 Portfolio and benchmark performance. 3045 -index: 3046 "date": pd.DatetimeIndex 3047 -columns: 3048 "benchmark": benchmark performance, % return 3049 "turnover": portfolio turnover, % of equity 3050 "portfolio": return since beginning of portfolio, % return 3051 "daily_returns": daily percent change in value of the portfolio, % return 3052 (this column is optional and depends on the daily_returns flag) 3053 """ 3054 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3055 return client.get_portfolio_performance(portfolio_id, start_date, end_date, daily_returns)
Get performance data for a portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object Portfolio and benchmark performance. -index: "date": pd.DatetimeIndex -columns: "benchmark": benchmark performance, % return "turnover": portfolio turnover, % of equity "portfolio": return since beginning of portfolio, % return "daily_returns": daily percent change in value of the portfolio, % return (this column is optional and depends on the daily_returns flag)
3058def getPortfolioFactors( 3059 apikey: str, 3060 model_id: str, 3061 portfolio_id: str, 3062 proxy: Optional[str] = None, 3063 disable_verify_ssl: bool = False, 3064) -> pd.DataFrame: 3065 """ 3066 Get factor data concerning a hedge experiment portfolio 3067 3068 Parameters 3069 ---------- 3070 apikey: str 3071 API key provided by Boosted. This key should be protected as a secret. 3072 model_id: str 3073 UUID corresponding to the model in question. 3074 portfolio_id: str 3075 UUID corresponding to the portfolio in question. 3076 proxy: str 3077 Your organization may require the use of a proxy for access. 3078 The address of a HTTPS proxy in the format of <address>:<port>. 3079 Examples are "123.456.789:123" or "my.proxy.com:123". 3080 Do not prepend with "https://". 3081 disable_verify_ssl: bool 3082 Your networking setup may be behind a firewall which performs SSL 3083 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3084 to point to the location of a custom certificate bundle, or set this 3085 parameter to true to disable SSL verification as a workaround. 3086 3087 Returns 3088 ------- 3089 pd.DataFrame object 3090 - index: 3091 "date": pd.DatetimeIndex 3092 - columns: 3093 The following are factor weights corresponding to the named column. 3094 "size", 3095 "momentum", 3096 "dividend_yield", 3097 "volatility", 3098 "trading_activity", 3099 "value", 3100 "earnings_variability", 3101 "profitability", 3102 "growth", 3103 "leverage", 3104 "income_statement", 3105 "balance_sheet", 3106 "cash_flow", 3107 "environment", 3108 "social", 3109 "governance", 3110 "machine_1", 3111 "machine_2", 3112 "machine_3", 3113 "machine_4", 3114 "machine_5", 3115 "machine_6", 3116 "machine_7", 3117 "machine_8", 3118 "machine_9", 3119 "machine_10" 3120 """ 3121 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3122 return client.get_portfolio_factors(model_id, portfolio_id)
Get factor data concerning a hedge experiment portfolio
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID corresponding to the model in question. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object - index: "date": pd.DatetimeIndex - columns: The following are factor weights corresponding to the named column. "size", "momentum", "dividend_yield", "volatility", "trading_activity", "value", "earnings_variability", "profitability", "growth", "leverage", "income_statement", "balance_sheet", "cash_flow", "environment", "social", "governance", "machine_1", "machine_2", "machine_3", "machine_4", "machine_5", "machine_6", "machine_7", "machine_8", "machine_9", "machine_10"
3125def getPortfolioVolatility( 3126 apikey: str, 3127 model_id: str, 3128 portfolio_id: str, 3129 proxy: Optional[str] = None, 3130 disable_verify_ssl: bool = False, 3131) -> pd.DataFrame: 3132 """ 3133 Get volatility data concerning a hedge experiment portfolio 3134 3135 Parameters 3136 ---------- 3137 apikey: str 3138 API key provided by Boosted. This key should be protected as a secret. 3139 model_id: str 3140 UUID corresponding to the model in question. 3141 portfolio_id: str 3142 UUID corresponding to the portfolio in question. 3143 proxy: str 3144 Your organization may require the use of a proxy for access. 3145 The address of a HTTPS proxy in the format of <address>:<port>. 3146 Examples are "123.456.789:123" or "my.proxy.com:123". 3147 Do not prepend with "https://". 3148 disable_verify_ssl: bool 3149 Your networking setup may be behind a firewall which performs SSL 3150 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3151 to point to the location of a custom certificate bundle, or set this 3152 parameter to true to disable SSL verification as a workaround. 3153 3154 Returns 3155 ------- 3156 pd.DataFrame object 3157 - index: 3158 "date": pd.DatetimeIndex 3159 - columns: 3160 "avg_5d", 3161 "avg_10d", 3162 "avg_21d", 3163 "avg_63d", 3164 "avg_126d", 3165 "avg_189d", 3166 "avg_252d", 3167 "avg_315d", 3168 "avg_378d", 3169 "avg_441d", 3170 "avg_504d" 3171 """ 3172 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3173 return client.get_portfolio_volatility(model_id, portfolio_id)
Get volatility data concerning a hedge experiment portfolio
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID corresponding to the model in question. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object - index: "date": pd.DatetimeIndex - columns: "avg_5d", "avg_10d", "avg_21d", "avg_63d", "avg_126d", "avg_189d", "avg_252d", "avg_315d", "avg_378d", "avg_441d", "avg_504d"
3176def getPortfolioHoldings( 3177 apikey: str, 3178 model_id: str, 3179 portfolio_id: str, 3180 proxy: Optional[str] = None, 3181 disable_verify_ssl: bool = False, 3182) -> pd.DataFrame: 3183 """ 3184 Get holdings concerning a hedge experiment portfolio 3185 3186 Parameters 3187 ---------- 3188 apikey: str 3189 API key provided by Boosted. This key should be protected as a secret. 3190 model_id: str 3191 UUID corresponding to the model in question. 3192 portfolio_id: str 3193 UUID corresponding to the portfolio in question. 3194 proxy: str 3195 Your organization may require the use of a proxy for access. 3196 The address of a HTTPS proxy in the format of <address>:<port>. 3197 Examples are "123.456.789:123" or "my.proxy.com:123". 3198 Do not prepend with "https://". 3199 disable_verify_ssl: bool 3200 Your networking setup may be behind a firewall which performs SSL 3201 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3202 to point to the location of a custom certificate bundle, or set this 3203 parameter to true to disable SSL verification as a workaround. 3204 3205 Returns 3206 ------- 3207 pd.DataFrame object 3208 - index: 3209 "date": pd.DatetimeIndex 3210 - columns: 3211 "ticker", 3212 "isin", 3213 "region", 3214 "currency", 3215 "allocation" 3216 """ 3217 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3218 return client.get_portfolio_holdings(model_id, portfolio_id)
Get holdings concerning a hedge experiment portfolio
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID corresponding to the model in question. portfolio_id: str UUID corresponding to the portfolio in question. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame object - index: "date": pd.DatetimeIndex - columns: "ticker", "isin", "region", "currency", "allocation"
3221def getStockDataTableForDate( 3222 apikey: str, 3223 model_id: str, 3224 portfolio_id: str, 3225 date: BoostedDate = datetime.date.today(), 3226 proxy: Optional[str] = None, 3227 disable_verify_ssl: bool = False, 3228) -> pd.DataFrame: 3229 """ 3230 Returns stock pricing and factors data for a given date. 3231 3232 Parameters 3233 ---------- 3234 apikey: str 3235 API key provided by Boosted. This key should be protected as a secret. 3236 model_id: str 3237 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 3238 button next to your model's name in the Model Summary Page in Boosted 3239 Insights. 3240 portfolio_id: str 3241 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 3242 date: datetime.date | str 3243 Date for which to fetch stock data table. Defaults to today. 3244 proxy: str 3245 Your organization may require the use of a proxy for access. 3246 The address of a HTTPS proxy in the format of <address>:<port>. 3247 Examples are "123.456.789:123" or "my.proxy.com:123". 3248 Do not prepend with "https://". 3249 disable_verify_ssl: bool 3250 Your networking setup may be behind a firewall which performs SSL 3251 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3252 to point to the location of a custom certificate bundle, or set this 3253 parameter to true to disable SSL verification as a workaround. 3254 3255 Returns 3256 ------- 3257 Stock data table as a dataframe indexed by ticker. 3258 """ 3259 date = convert_date(date) 3260 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3261 return client.getStockDataTableForDate(model_id, portfolio_id, date)
Returns stock pricing and factors data for a given date.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch stock data table. Defaults to today. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Stock data table as a dataframe indexed by ticker.
3264def addHedgeExperimentScenario( 3265 apikey: str, 3266 experiment_id: str, 3267 scenario_name: str, 3268 scenario_settings: PortfolioSettings, 3269 run_scenario_immediately: bool = True, 3270 proxy: Optional[str] = None, 3271 disable_verify_ssl: bool = False, 3272) -> HedgeExperimentScenario: 3273 """ 3274 Create a hedge experiment scenario the Boosted platform. 3275 3276 Parameters 3277 ---------- 3278 apikey: str 3279 API key provided by Boosted. This key should be protected as a secret. 3280 experiment: HedgeExperiment 3281 An instance of the HedgeExperiment class that specifies 3282 your experiment configuration and metadata. 3283 run_scenario_immediately: Optional[bool] (default True) 3284 Flag that indicates whether to run the scenario upon submission or wait 3285 for a independent call to start the scenario at a later time. 3286 proxy: str 3287 Your organization may require the use of a proxy for access. 3288 The address of a HTTPS proxy in the format of <address>:<port>. 3289 Examples are "123.456.789:123" or "my.proxy.com:123". 3290 Do not prepend with "https://". 3291 disable_verify_ssl: bool 3292 Your networking setup may be behind a firewall which performs SSL 3293 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3294 to point to the location of a custom certificate bundle, or set this 3295 parameter to true to disable SSL verification as a workaround. 3296 3297 Returns 3298 ------- 3299 HedgeExperimentScenario 3300 - A scenario instance with associated metadata 3301 """ 3302 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3303 return client.add_hedge_experiment_scenario( 3304 experiment_id, scenario_name, scenario_settings, run_scenario_immediately 3305 )
Create a hedge experiment scenario the Boosted platform.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment: HedgeExperiment An instance of the HedgeExperiment class that specifies your experiment configuration and metadata. run_scenario_immediately: Optional[bool] (default True) Flag that indicates whether to run the scenario upon submission or wait for a independent call to start the scenario at a later time. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperimentScenario - A scenario instance with associated metadata
3308def createHedgeExperiment( 3309 apikey: str, 3310 experiment_name: str, 3311 experiment_description: str, 3312 experiment_type: hedge_experiment_type, 3313 target_securities: Union[Dict[GbiIdSecurity, float], str], 3314 proxy: Optional[str] = None, 3315 disable_verify_ssl: bool = False, 3316) -> HedgeExperiment: 3317 """ 3318 Creates a hedge experiment on the Boosted platform, returning an object 3319 representation of it. Note that currently this does NOT start the experiment; 3320 as created, the experiment is in an incomplete, draft state 3321 3322 Parameters 3323 ---------- 3324 apikey: str 3325 API key provided by Boosted. This key should be protected as a secret. 3326 experiment_name: str 3327 Name of the experiment 3328 experiment_description: str 3329 Your description of the experiment. 3330 experiment_type: str 3331 "HEDGE" - hedge out the risk of target securities 3332 "MIMIC" - mimic the target securities 3333 target_securities: Dict[GbiIdSecurity, float] | str 3334 Specification of securities to hedge or mimic as a weighted basket. This parameter 3335 can take the form of: 3336 {GbiIdSecurity: weight} - to manually specify securities and weights, OR 3337 portfolio_id - to use the most recent holdings/allocations of the passed 3338 portfolio as the securities and weights 3339 proxy: str 3340 Your organization may require the use of a proxy for access. 3341 The address of a HTTPS proxy in the format of <address>:<port>. 3342 Examples are "123.456.789:123" or "my.proxy.com:123". 3343 Do not prepend with "https://". 3344 disable_verify_ssl: bool 3345 Your networking setup may be behind a firewall which performs SSL 3346 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3347 to point to the location of a custom certificate bundle, or set this 3348 parameter to true to disable SSL verification as a workaround. 3349 Returns 3350 ------- 3351 HedgeExperiment 3352 """ 3353 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3354 return client.create_hedge_experiment( 3355 experiment_name, 3356 experiment_description, 3357 experiment_type, 3358 target_securities=target_securities, 3359 )
Creates a hedge experiment on the Boosted platform, returning an object representation of it. Note that currently this does NOT start the experiment; as created, the experiment is in an incomplete, draft state
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment experiment_description: str Your description of the experiment. experiment_type: str "HEDGE" - hedge out the risk of target securities "MIMIC" - mimic the target securities target_securities: Dict[GbiIdSecurity, float] | str Specification of securities to hedge or mimic as a weighted basket. This parameter can take the form of: {GbiIdSecurity: weight} - to manually specify securities and weights, OR portfolio_id - to use the most recent holdings/allocations of the passed portfolio as the securities and weights proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment
3362def modifyHedgeExperiment( 3363 apikey: str, 3364 experiment_id: str, 3365 experiment_name: Optional[str] = None, 3366 experiment_description: Optional[str] = None, 3367 experiment_type: Optional[hedge_experiment_type] = None, 3368 target_securities: Union[Dict[GbiIdSecurity, float], str, None] = None, 3369 model_ids: Optional[List[str]] = None, 3370 stock_universe_ids: Optional[List[str]] = None, 3371 create_default_scenario: bool = True, 3372 baseline_model_id: Optional[str] = None, 3373 baseline_stock_universe_id: Optional[str] = None, 3374 baseline_portfolio_settings: Optional[str] = None, 3375 proxy: Optional[str] = None, 3376 disable_verify_ssl: bool = False, 3377) -> HedgeExperiment: 3378 """ 3379 Modifies an existing hedge experiment on the Boosted platform, returning an object 3380 representation of it. Note that currently this does NOT start the experiment; 3381 a modified experiment is still in a draft state. 3382 3383 Parameters 3384 ---------- 3385 apikey: str 3386 API key provided by Boosted. This key should be protected as a secret. 3387 experiment_name: str 3388 Name of the experiment 3389 experiment_description: str 3390 Your description of the experiment. 3391 experiment_type: str 3392 "HEDGE" - hedge out the risk of target securities 3393 "MIMIC" - mimic the target securities 3394 target_securities: Dict[GbiIdSecurity, float] | str | None (default) 3395 Specification of securities to hedge or mimic as a weighted basket. This parameter 3396 can take the form of: 3397 {GbiIdSecurity: weight} - to manually specify securities and weights, OR 3398 portfolio_id - to use the most recent holdings/allocations of the passed 3399 portfolio as the securities and weights 3400 model_ids: List[str] 3401 A list of model ids that will be used for constructing scenario portfolios 3402 stock_universe_ids: List[str] 3403 A list of stock universe ids that will be used for constructing scenario portfolios 3404 create_default_scenario: bool 3405 Whether to create a "default/inferred" scenario 3406 baseline_model_id: str 3407 Model id to (optionally) use for the baseline portfolio 3408 baseline_stock_universe_id: str 3409 Universe id to use for the baseline portfolio 3410 baseline_portfolio_settings: str 3411 A valid json-string specifying settings for the baseline portfolio 3412 proxy: str 3413 Your organization may require the use of a proxy for access. 3414 The address of a HTTPS proxy in the format of <address>:<port>. 3415 Examples are "123.456.789:123" or "my.proxy.com:123". 3416 Do not prepend with "https://". 3417 disable_verify_ssl: bool 3418 Your networking setup may be behind a firewall which performs SSL 3419 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3420 to point to the location of a custom certificate bundle, or set this 3421 parameter to true to disable SSL verification as a workaround. 3422 3423 Returns 3424 ------- 3425 HedgeExperiment 3426 """ 3427 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3428 return client.modify_hedge_experiment( 3429 experiment_id, 3430 name=experiment_name, 3431 description=experiment_description, 3432 experiment_type=experiment_type, 3433 target_securities=target_securities, 3434 model_ids=model_ids, 3435 stock_universe_ids=stock_universe_ids, 3436 create_default_scenario=create_default_scenario, 3437 baseline_model_id=baseline_model_id, 3438 baseline_stock_universe_id=baseline_stock_universe_id, 3439 baseline_portfolio_settings=baseline_portfolio_settings, 3440 )
Modifies an existing hedge experiment on the Boosted platform, returning an object representation of it. Note that currently this does NOT start the experiment; a modified experiment is still in a draft state.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment experiment_description: str Your description of the experiment. experiment_type: str "HEDGE" - hedge out the risk of target securities "MIMIC" - mimic the target securities target_securities: Dict[GbiIdSecurity, float] | str | None (default) Specification of securities to hedge or mimic as a weighted basket. This parameter can take the form of: {GbiIdSecurity: weight} - to manually specify securities and weights, OR portfolio_id - to use the most recent holdings/allocations of the passed portfolio as the securities and weights model_ids: List[str] A list of model ids that will be used for constructing scenario portfolios stock_universe_ids: List[str] A list of stock universe ids that will be used for constructing scenario portfolios create_default_scenario: bool Whether to create a "default/inferred" scenario baseline_model_id: str Model id to (optionally) use for the baseline portfolio baseline_stock_universe_id: str Universe id to use for the baseline portfolio baseline_portfolio_settings: str A valid json-string specifying settings for the baseline portfolio proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment
3443def startHedgeExperiment( 3444 apikey: str, 3445 experiment_id: str, 3446 *scenario_ids: str, 3447 proxy: Optional[str] = None, 3448 disable_verify_ssl: bool = False, 3449) -> HedgeExperiment: 3450 """ 3451 Starts an existing hedge experiment on the Boosted platform, returning an object 3452 representation of it. This function also starts the indicated scenarios. 3453 3454 Parameters 3455 ---------- 3456 apikey: str 3457 API key provided by Boosted. This key should be protected as a secret. 3458 experiment_name: str 3459 Name of the experiment 3460 scenario_ids: str 3461 Var-args corresponding to scenario ids that you would like to start. 3462 proxy: str 3463 Your organization may require the use of a proxy for access. 3464 The address of a HTTPS proxy in the format of <address>:<port>. 3465 Examples are "123.456.789:123" or "my.proxy.com:123". 3466 Do not prepend with "https://". 3467 disable_verify_ssl: bool 3468 Your networking setup may be behind a firewall which performs SSL 3469 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3470 to point to the location of a custom certificate bundle, or set this 3471 parameter to true to disable SSL verification as a workaround. 3472 3473 Returns 3474 ------- 3475 HedgeExperiment 3476 """ 3477 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3478 return client.start_hedge_experiment(experiment_id, *scenario_ids)
Starts an existing hedge experiment on the Boosted platform, returning an object representation of it. This function also starts the indicated scenarios.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment scenario_ids: str Var-args corresponding to scenario ids that you would like to start. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
HedgeExperiment
3481def deleteHedgeExperiment( 3482 apikey: str, experiment_id: str, proxy: Optional[str] = None, disable_verify_ssl: bool = False 3483) -> bool: 3484 """ 3485 Deletes a hedge experiment and all associated scenarios. This is a permanent, 3486 irreversible action! 3487 3488 Parameters 3489 ---------- 3490 apikey: str 3491 API key provided by Boosted. This key should be protected as a secret. 3492 experiment_name: str 3493 Name of the experiment 3494 proxy: str 3495 Your organization may require the use of a proxy for access. 3496 The address of a HTTPS proxy in the format of <address>:<port>. 3497 Examples are "123.456.789:123" or "my.proxy.com:123". 3498 Do not prepend with "https://". 3499 disable_verify_ssl: bool 3500 Your networking setup may be behind a firewall which performs SSL 3501 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3502 to point to the location of a custom certificate bundle, or set this 3503 parameter to true to disable SSL verification as a workaround. 3504 3505 Returns 3506 ------- 3507 None 3508 """ 3509 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3510 return client.delete_hedge_experiment(experiment_id)
Deletes a hedge experiment and all associated scenarios. This is a permanent, irreversible action!
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_name: str Name of the experiment proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
3513def createHedgeBasketPositionBoundsFromCsv( 3514 apikey: str, 3515 filepath: str, 3516 name: str, 3517 description: Optional[str] = None, 3518 mapping_result_filepath: Optional[str] = None, 3519 proxy: Optional[str] = None, 3520 disable_verify_ssl: bool = False, 3521) -> str: 3522 """ 3523 Creates a hedge basket security-level position bounds template setting from 3524 an input CSV of ISINs and weight constraints. 3525 3526 Parameters 3527 ---------- 3528 apikey: str 3529 API key provided by Boosted. This key should be protected as a secret. 3530 filepath: str 3531 Path to csv file from which to create the position bounds template. 3532 Required Columns: 3533 ISIN: str 3534 Lower Bound: float, 0-1 3535 Upper Bound: float, 0-1 3536 Optional Columns for use in security mapping: 3537 Date: str, ISO format 3538 Country: str, ISO format 3539 Currency: str, ISO format 3540 name: str 3541 name for the position bounds template 3542 description: str 3543 optional description for the position bounds template 3544 mapping_result_filepath: str 3545 if provided, writes the result of the mapping to this file location 3546 proxy: str 3547 Your organization may require the use of a proxy for access. 3548 The address of a HTTPS proxy in the format of <address>:<port>. 3549 Examples are "123.456.789:123" or "my.proxy.com:123". 3550 Do not prepend with "https://". 3551 disable_verify_ssl: bool 3552 Your networking setup may be behind a firewall which performs SSL 3553 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3554 to point to the location of a custom certificate bundle, or set this 3555 parameter to true to disable SSL verification as a workaround. 3556 3557 Returns 3558 ------- 3559 template_id: str 3560 UUID to identify the newly created position bounds template in the UI. 3561 """ 3562 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3563 return client.create_hedge_basket_position_bounds_from_csv( 3564 filepath, name, description, mapping_result_filepath 3565 )
Creates a hedge basket security-level position bounds template setting from an input CSV of ISINs and weight constraints.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. filepath: str Path to csv file from which to create the position bounds template. Required Columns: ISIN: str Lower Bound: float, 0-1 Upper Bound: float, 0-1 Optional Columns for use in security mapping: Date: str, ISO format Country: str, ISO format Currency: str, ISO format name: str name for the position bounds template description: str optional description for the position bounds template mapping_result_filepath: str if provided, writes the result of the mapping to this file location proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
template_id: str UUID to identify the newly created position bounds template in the UI.
3568def getPortfolioAccuracy( 3569 apikey: str, 3570 model_id: str, 3571 portfolio_id: str, 3572 proxy: Optional[str] = None, 3573 disable_verify_ssl: bool = False, 3574 start_date: Optional[BoostedDate] = None, 3575 end_date: Optional[BoostedDate] = None, 3576) -> dict: 3577 """ 3578 Get the accuracy (hit rate & excess return) information of a given portfolio. 3579 Parameters 3580 ---------- 3581 apikey: str 3582 API key provided by Boosted. This key should be protected as a secret. 3583 model_id: str 3584 Model ID of the portfolio to fetch data for. 3585 portfolio_id: str 3586 ID of the portfolio to fetch data for. 3587 proxy: str 3588 Your organization may require the use of a proxy for access. 3589 The address of a HTTPS proxy in the format of <address>:<port>. 3590 Examples are "123.456.789:123" or "my.proxy.com:123". 3591 Do not prepend with "https://". 3592 disable_verify_ssl: bool 3593 Your networking setup may be behind a firewall which performs SSL 3594 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3595 to point to the location of a custom certificate bundle, or set this 3596 parameter to true to disable SSL verification as a workaround. 3597 start_date: Optional[datetime.date | str] 3598 Start date for portfolio accuracy date range. If this or end_date is 3599 omitted, full history will be returned. 3600 end_date: Optional[datetime.date | str] 3601 End date for portfolio accuracy date range. If this or start_date is 3602 omitted, full history will be returned. 3603 3604 Returns 3605 ------- 3606 accuracy: dict 3607 Dictionary containing accuracy information by Quantile, Decile and Ventile. 3608 """ 3609 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3610 return client.get_portfolio_accuracy( 3611 model_id, portfolio_id, start_date=start_date, end_date=end_date 3612 )
Get the accuracy (hit rate & excess return) information of a given portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID of the portfolio to fetch data for. portfolio_id: str ID of the portfolio to fetch data for. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
accuracy: dict Dictionary containing accuracy information by Quantile, Decile and Ventile.
3615def createWatchlist( 3616 apikey: str, 3617 name: str, 3618 proxy: Optional[str] = None, 3619 disable_verify_ssl: bool = False, 3620) -> str: 3621 """ 3622 Create a watchlist and get back the watchlist_id for it 3623 3624 Parameters 3625 ---------- 3626 apikey: str 3627 API key provided by Boosted. This key should be protected as a secret. 3628 name: str 3629 Name to associate with the watchlist 3630 proxy: str 3631 Your organization may require the use of a proxy for access. 3632 The address of a HTTPS proxy in the format of <address>:<port>. 3633 Examples are "123.456.789:123" or "my.proxy.com:123". 3634 Do not prepend with "https://". 3635 disable_verify_ssl: bool 3636 Your networking setup may be behind a firewall which performs SSL 3637 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3638 to point to the location of a custom certificate bundle, or set this 3639 parameter to true to disable SSL verification as a workaround. 3640 Returns 3641 ------- 3642 watchlist_id: str 3643 UUID to uniquely identify the newly created watchlist 3644 """ 3645 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3646 return client.create_watchlist(name)
Create a watchlist and get back the watchlist_id for it
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. name: str Name to associate with the watchlist proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
watchlist_id: str UUID to uniquely identify the newly created watchlist
3649def createWatchlistFromFile( 3650 apikey: str, 3651 name: str, 3652 filepath: str, 3653 proxy: Optional[str] = None, 3654 disable_verify_ssl: bool = False, 3655) -> str: 3656 """ 3657 Create a watchlist and get back the watchlist_id for it 3658 3659 Parameters 3660 ---------- 3661 apikey: str 3662 API key provided by Boosted. This key should be protected as a secret. 3663 name: str 3664 Name to associate with the watchlist 3665 filepath: str 3666 path to file to upload, 3667 proxy: str 3668 Your organization may require the use of a proxy for access. 3669 The address of a HTTPS proxy in the format of <address>:<port>. 3670 Examples are "123.456.789:123" or "my.proxy.com:123". 3671 Do not prepend with "https://". 3672 disable_verify_ssl: bool 3673 Your networking setup may be behind a firewall which performs SSL 3674 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3675 to point to the location of a custom certificate bundle, or set this 3676 parameter to true to disable SSL verification as a workaround. 3677 Returns 3678 ------- 3679 watchlist_id: str 3680 UUID to uniquely identify the newly created watchlist 3681 """ 3682 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3683 return client.create_watchlist_from_file(name, filepath)
Create a watchlist and get back the watchlist_id for it
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. name: str Name to associate with the watchlist filepath: str path to file to upload, proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
watchlist_id: str UUID to uniquely identify the newly created watchlist
3686def getWatchlists( 3687 apikey: str, 3688 proxy: Optional[str] = None, 3689 disable_verify_ssl: bool = False, 3690) -> List[Dict]: 3691 """ 3692 Get the list of watchlists 3693 3694 Parameters 3695 ---------- 3696 apikey: str 3697 API key provided by Boosted. This key should be protected as a secret. 3698 proxy: str 3699 Your organization may require the use of a proxy for access. 3700 The address of a HTTPS proxy in the format of <address>:<port>. 3701 Examples are "123.456.789:123" or "my.proxy.com:123". 3702 Do not prepend with "https://". 3703 disable_verify_ssl: bool 3704 Your networking setup may be behind a firewall which performs SSL 3705 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3706 to point to the location of a custom certificate bundle, or set this 3707 parameter to true to disable SSL verification as a workaround. 3708 Returns 3709 ------- 3710 watchlists: List[Dict] 3711 List of dictionaries with watchlist_id and name 3712 """ 3713 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3714 return client.get_watchlists()
Get the list of watchlists
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
watchlists: List[Dict] List of dictionaries with watchlist_id and name
3717def getWatchlistContents( 3718 apikey: str, 3719 watchlist_id: str, 3720 proxy: Optional[str] = None, 3721 disable_verify_ssl: bool = False, 3722) -> Dict: 3723 """ 3724 Add a list of ISINs to a watchlist 3725 Parameters 3726 ---------- 3727 apikey: str 3728 API key provided by Boosted. This key should be protected as a secret. 3729 watchlist_id: str 3730 The UUID for an existing watchlist that the user has read access to 3731 proxy: str 3732 Your organization may require the use of a proxy for access. 3733 The address of a HTTPS proxy in the format of <address>:<port>. 3734 Examples are "123.456.789:123" or "my.proxy.com:123". 3735 Do not prepend with "https://". 3736 disable_verify_ssl: bool 3737 Your networking setup may be behind a firewall which performs SSL 3738 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3739 to point to the location of a custom certificate bundle, or set this 3740 parameter to true to disable SSL verification as a workaround. 3741 Returns 3742 ------- 3743 Information suitable to recreate the watchlist 3744 Dict { 3745 "watchlist_id": str 3746 "contents": List[Dict] 3747 Keys: 'ISIN' 'TICKER', 'COUNTRY', 'CURRENCY', 'CATEGORY' 3748 } 3749 3750 """ 3751 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3752 return client.get_watchlist_contents(watchlist_id)
Add a list of ISINs to a watchlist
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Information suitable to recreate the watchlist
Dict { "watchlist_id": str "contents": List[Dict] Keys: 'ISIN' 'TICKER', 'COUNTRY', 'CURRENCY', 'CATEGORY' }
3755def getWatchlistContentsAsCsv( 3756 apikey: str, 3757 watchlist_id: str, 3758 filepath: str, 3759 proxy: Optional[str] = None, 3760 disable_verify_ssl: bool = False, 3761) -> None: 3762 """ 3763 Get Watchlist securities in csv format 3764 Parameters 3765 ---------- 3766 apikey: str 3767 API key provided by Boosted. This key should be protected as a secret. 3768 watchlist_id: str 3769 The UUID for an existing watchlist that the user has read access to 3770 filepath: str 3771 Destination for csv file to be written to 3772 proxy: str 3773 Your organization may require the use of a proxy for access. 3774 The address of a HTTPS proxy in the format of <address>:<port>. 3775 Examples are "123.456.789:123" or "my.proxy.com:123". 3776 Do not prepend with "https://". 3777 disable_verify_ssl: bool 3778 Your networking setup may be behind a firewall which performs SSL 3779 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3780 to point to the location of a custom certificate bundle, or set this 3781 parameter to true to disable SSL verification as a workaround. 3782 Returns 3783 ------- 3784 None 3785 """ 3786 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3787 return client.get_watchlist_contents_as_csv(watchlist_id, filepath)
Get Watchlist securities in csv format
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to filepath: str Destination for csv file to be written to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None
3790def getCoverageInfo( 3791 apikey: str, 3792 watchlist_id: str, 3793 portfolio_group_id: str, 3794 proxy: Optional[str] = None, 3795 disable_verify_ssl: bool = False, 3796) -> pd.DataFrame: 3797 """ 3798 Get Coverage info for a given watchlist and portfolio group 3799 Parameters 3800 ---------- 3801 apikey: str 3802 API key provided by Boosted. This key should be protected as a secret. 3803 watchlist_id: str 3804 The UUID for an existing watchlist that the user has read access to 3805 portfolio_group_id: str 3806 The UUID for an existing portfolio group that the user has read access to 3807 proxy: str 3808 Your organization may require the use of a proxy for access. 3809 The address of a HTTPS proxy in the format of <address>:<port>. 3810 Examples are "123.456.789:123" or "my.proxy.com:123". 3811 Do not prepend with "https://". 3812 disable_verify_ssl: bool 3813 Your networking setup may be behind a firewall which performs SSL 3814 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3815 to point to the location of a custom certificate bundle, or set this 3816 parameter to true to disable SSL verification as a workaround. 3817 Returns 3818 ------- 3819 pd.DataFrame 3820 """ 3821 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3822 return client.get_coverage_info(watchlist_id, portfolio_group_id)
Get Coverage info for a given watchlist and portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to portfolio_group_id: str The UUID for an existing portfolio group that the user has read access to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
pd.DataFrame
3825def getCoverageCsv( 3826 apikey: str, 3827 watchlist_id: str, 3828 portfolio_group_id: str, 3829 filepath: Optional[str], 3830 proxy: Optional[str] = None, 3831 disable_verify_ssl: bool = False, 3832) -> Optional[str]: 3833 """ 3834 Get Coverage info for a given watchlist and portfolio group 3835 Parameters 3836 ---------- 3837 apikey: str 3838 API key provided by Boosted. This key should be protected as a secret. 3839 watchlist_id: str 3840 The UUID for an existing watchlist that the user has read access to 3841 portfolio_group_id: str 3842 The UUID for an existing portfolio group that the user has read access to 3843 filepath: Optional[str] = None 3844 The location to write csv file to 3845 proxy: str 3846 Your organization may require the use of a proxy for access. 3847 The address of a HTTPS proxy in the format of <address>:<port>. 3848 Examples are "123.456.789:123" or "my.proxy.com:123". 3849 Do not prepend with "https://". 3850 disable_verify_ssl: bool 3851 Your networking setup may be behind a firewall which performs SSL 3852 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3853 to point to the location of a custom certificate bundle, or set this 3854 parameter to true to disable SSL verification as a workaround. 3855 Returns 3856 ------- 3857 None if filepath is provided, else a string with a csv's contents is returned 3858 """ 3859 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3860 return client.get_coverage_csv(watchlist_id, portfolio_group_id, filepath)
Get Coverage info for a given watchlist and portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has read access to portfolio_group_id: str The UUID for an existing portfolio group that the user has read access to filepath: Optional[str] = None The location to write csv file to proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
None if filepath is provided, else a string with a csv's contents is returned
3863def addSecuritiesToWatchlist( 3864 apikey: str, 3865 watchlist_id: str, 3866 identifiers: List[str], 3867 identifier_type: Literal["TICKER", "ISIN"], 3868 proxy: Optional[str] = None, 3869 disable_verify_ssl: bool = False, 3870) -> Dict: 3871 """ 3872 Add a list of ISINs to a watchlist 3873 Parameters 3874 ---------- 3875 apikey: str 3876 API key provided by Boosted. This key should be protected as a secret. 3877 watchlist_id: str 3878 The UUID for an existing watchlist that the user has write access to 3879 identifiers: List[str] 3880 The list of identifiers to be added to the watchlist. These identifiers can 3881 be tickers or ISINs. See identifier_type. 3882 identifier_type: Literal["TICKER", "ISIN"] 3883 Specifier for the type of identifier. 3884 proxy: str 3885 Your organization may require the use of a proxy for access. 3886 The address of a HTTPS proxy in the format of <address>:<port>. 3887 Examples are "123.456.789:123" or "my.proxy.com:123". 3888 Do not prepend with "https://". 3889 disable_verify_ssl: bool 3890 Your networking setup may be behind a firewall which performs SSL 3891 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3892 to point to the location of a custom certificate bundle, or set this 3893 parameter to true to disable SSL verification as a workaround. 3894 Returns 3895 ------- 3896 status: Dict #FIXME - im not sure what we want to return here 3897 Information about what was modified to in the watchlist 3898 """ 3899 if identifier_type not in ["TICKER", "ISIN"]: 3900 raise ValueError( 3901 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 3902 ) 3903 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3904 return client.add_securities_to_watchlist(watchlist_id, identifiers, identifier_type)
Add a list of ISINs to a watchlist
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has write access to identifiers: List[str] The list of identifiers to be added to the watchlist. These identifiers can be tickers or ISINs. See identifier_type. identifier_type: Literal["TICKER", "ISIN"] Specifier for the type of identifier. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
status: Dict #FIXME - im not sure what we want to return here Information about what was modified to in the watchlist
3907def removeSecuritiesFromWatchlist( 3908 apikey: str, 3909 watchlist_id: str, 3910 identifiers: List[str], 3911 identifier_type: Literal["TICKER", "ISIN"], 3912 proxy: Optional[str] = None, 3913 disable_verify_ssl: bool = False, 3914) -> Dict: 3915 """ 3916 Add a list of ISINs to a watchlist 3917 Parameters 3918 ---------- 3919 apikey: str 3920 API key provided by Boosted. This key should be protected as a secret. 3921 watchlist_id: str 3922 The UUID for an existing watchlist that the user has write access to 3923 identifiers: List[str] 3924 The list of identifiers to be added to the watchlist. These identifiers can 3925 be tickers or ISINs. See identifier_type. 3926 identifier_type: Literal["TICKER", "ISIN"] 3927 Specifier for the type of identifier. 3928 proxy: str 3929 Your organization may require the use of a proxy for access. 3930 The address of a HTTPS proxy in the format of <address>:<port>. 3931 Examples are "123.456.789:123" or "my.proxy.com:123". 3932 Do not prepend with "https://". 3933 disable_verify_ssl: bool 3934 Your networking setup may be behind a firewall which performs SSL 3935 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3936 to point to the location of a custom certificate bundle, or set this 3937 parameter to true to disable SSL verification as a workaround. 3938 Returns 3939 ------- 3940 status: Dict #FIXME - im not sure what we want to return here 3941 Information about what was modified to in the watchlist 3942 """ 3943 if identifier_type not in ["TICKER", "ISIN"]: 3944 raise ValueError( 3945 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 3946 ) 3947 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3948 return client.remove_securities_from_watchlist(watchlist_id, identifiers, identifier_type)
Add a list of ISINs to a watchlist
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. watchlist_id: str The UUID for an existing watchlist that the user has write access to identifiers: List[str] The list of identifiers to be added to the watchlist. These identifiers can be tickers or ISINs. See identifier_type. identifier_type: Literal["TICKER", "ISIN"] Specifier for the type of identifier. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
status: Dict #FIXME - im not sure what we want to return here Information about what was modified to in the watchlist
3951def setPortfolioGroupForWatchlist( 3952 apikey: str, 3953 portfolio_group_id: str, 3954 watchlist_id: str, 3955 proxy: Optional[str] = None, 3956 disable_verify_ssl: bool = False, 3957) -> Dict: 3958 """ 3959 Set portfolio group for watchlist. 3960 3961 Parameters 3962 ---------- 3963 apikey: str 3964 API key provided by Boosted. This key should be protected as a secret. 3965 portfolio_group_id: str, 3966 UUID str identifying a portfolio group 3967 watchlist_id: str, 3968 UUID str identifying a watchlist 3969 proxy: str 3970 Your organization may require the use of a proxy for access. 3971 The address of a HTTPS proxy in the format of <address>:<port>. 3972 Examples are "123.456.789:123" or "my.proxy.com:123". 3973 Do not prepend with "https://". 3974 disable_verify_ssl: bool 3975 Your networking setup may be behind a firewall which performs SSL 3976 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 3977 to point to the location of a custom certificate bundle, or set this 3978 parameter to true to disable SSL verification as a workaround. 3979 Returns 3980 ------- 3981 Dict: with a list of all portfolio groups for the user 3982 """ 3983 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 3984 return client.set_portfolio_group_for_watchlist(portfolio_group_id, watchlist_id)
Set portfolio group for watchlist.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_group_id: str, UUID str identifying a portfolio group watchlist_id: str, UUID str identifying a watchlist proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict: with a list of all portfolio groups for the user
3987def setStickyPortfolioGroup( 3988 apikey: str, 3989 portfolio_group_id: str, 3990 proxy: Optional[str] = None, 3991 disable_verify_ssl: bool = False, 3992) -> Dict: 3993 """ 3994 Set sticky portfolio group for the user. 3995 3996 Parameters 3997 ---------- 3998 apikey: str 3999 API key provided by Boosted. This key should be protected as a secret. 4000 portfolio_group_id: str, 4001 UUID str identifying a portfolio group 4002 proxy: str 4003 Your organization may require the use of a proxy for access. 4004 The address of a HTTPS proxy in the format of <address>:<port>. 4005 Examples are "123.456.789:123" or "my.proxy.com:123". 4006 Do not prepend with "https://". 4007 disable_verify_ssl: bool 4008 Your networking setup may be behind a firewall which performs SSL 4009 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4010 to point to the location of a custom certificate bundle, or set this 4011 parameter to true to disable SSL verification as a workaround. 4012 Returns 4013 ------- 4014 Dict: with a list of all portfolio groups for the user 4015 """ 4016 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4017 return client.set_sticky_portfolio_group(portfolio_group_id)
Set sticky portfolio group for the user.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_group_id: str, UUID str identifying a portfolio group proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict: with a list of all portfolio groups for the user
4020def getStickyPortfolioGroup( 4021 apikey: str, 4022 proxy: Optional[str] = None, 4023 disable_verify_ssl: bool = False, 4024) -> Dict: 4025 """ 4026 Get sticky portfolio group for the user. 4027 4028 Parameters 4029 ---------- 4030 apikey: str 4031 API key provided by Boosted. This key should be protected as a secret. 4032 proxy: str 4033 Your organization may require the use of a proxy for access. 4034 The address of a HTTPS proxy in the format of <address>:<port>. 4035 Examples are "123.456.789:123" or "my.proxy.com:123". 4036 Do not prepend with "https://". 4037 disable_verify_ssl: bool 4038 Your networking setup may be behind a firewall which performs SSL 4039 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4040 to point to the location of a custom certificate bundle, or set this 4041 parameter to true to disable SSL verification as a workaround. 4042 Returns 4043 ------- 4044 Dict { 4045 group_id: str 4046 group_name: str 4047 portfolios: List[PortfolioInGroup(Dict)] 4048 PortfolioInGroup(Dict): 4049 portfolio_id: str 4050 rank_in_group: Optional[int] = None 4051 portfolio_name: Optional[str] = None 4052 } 4053 """ 4054 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4055 return client.get_sticky_portfolio_group()
Get sticky portfolio group for the user.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict {
group_id: str
group_name: str
portfolios: List[PortfolioInGroup(Dict)]
PortfolioInGroup(Dict):
portfolio_id: str
rank_in_group: Optional[int] = None
portfolio_name: Optional[str] = None
}
4058def getPortfolioGroup( 4059 apikey: str, 4060 portfolio_group_id: str, 4061 proxy: Optional[str] = None, 4062 disable_verify_ssl: bool = False, 4063) -> Dict: 4064 """ 4065 Get a single portfolio group. 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 proxy: str 4074 Your organization may require the use of a proxy for access. 4075 The address of a HTTPS proxy in the format of <address>:<port>. 4076 Examples are "123.456.789:123" or "my.proxy.com:123". 4077 Do not prepend with "https://". 4078 disable_verify_ssl: bool 4079 Your networking setup may be behind a firewall which performs SSL 4080 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4081 to point to the location of a custom certificate bundle, or set this 4082 parameter to true to disable SSL verification as a workaround. 4083 Returns 4084 ------- 4085 PortfolioGroup: Dict: { 4086 group_id: str 4087 group_name: str 4088 portfolios: List[PortfolioInGroup] 4089 } 4090 where PortfolioInGroup is defined as = Dict { 4091 portfolio_id: str 4092 portfolio_name: str 4093 rank_in_group: Optional[int] 4094 } 4095 """ 4096 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4097 return client.get_portfolio_group(portfolio_group_id)
Get a single portfolio group.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_group_id: str, UUID str identifying a portfolio group proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
PortfolioGroup: Dict: { group_id: str group_name: str portfolios: List[PortfolioInGroup] } where PortfolioInGroup is defined as = Dict { portfolio_id: str portfolio_name: str rank_in_group: Optional[int] }
4100def getPortfolioGroups( 4101 apikey: str, 4102 proxy: Optional[str] = None, 4103 disable_verify_ssl: bool = False, 4104) -> Dict: 4105 """ 4106 Get a list of all portfolio groups for the user 4107 4108 Parameters 4109 ---------- 4110 apikey: str 4111 API key provided by Boosted. This key should be protected as a secret. 4112 proxy: str 4113 Your organization may require the use of a proxy for access. 4114 The address of a HTTPS proxy in the format of <address>:<port>. 4115 Examples are "123.456.789:123" or "my.proxy.com:123". 4116 Do not prepend with "https://". 4117 disable_verify_ssl: bool 4118 Your networking setup may be behind a firewall which performs SSL 4119 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4120 to point to the location of a custom certificate bundle, or set this 4121 parameter to true to disable SSL verification as a workaround. 4122 Returns 4123 ------- 4124 Dict: with a list of all portfolio groups for the user 4125 """ 4126 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4127 return client.get_portfolio_groups()
Get a list of all portfolio groups for the user
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict: with a list of all portfolio groups for the user
4130def createPortfolioGroup( 4131 apikey: str, 4132 group_name: str, 4133 portfolios: Optional[List[Dict]] = None, 4134 proxy: Optional[str] = None, 4135 disable_verify_ssl: bool = False, 4136) -> Dict: 4137 """ 4138 Create a new portfolio group 4139 4140 Parameters 4141 ---------- 4142 apikey: str 4143 API key provided by Boosted. This key should be protected as a secret. 4144 4145 group_name: str 4146 name of the new group 4147 4148 portfolios: List of Dict [: 4149 4150 portfolio_id: str 4151 rank_in_group: Optional[int] = None 4152 ] 4153 4154 proxy: str 4155 Your organization may require the use of a proxy for access. 4156 The address of a HTTPS proxy in the format of <address>:<port>. 4157 Examples are "123.456.789:123" or "my.proxy.com:123". 4158 Do not prepend with "https://". 4159 disable_verify_ssl: bool 4160 Your networking setup may be behind a firewall which performs SSL 4161 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4162 to point to the location of a custom certificate bundle, or set this 4163 parameter to true to disable SSL verification as a workaround. 4164 4165 4166 Returns: 4167 ---------- 4168 4169 Dict: { 4170 group_id: str 4171 UUID identifier for the portfolio group 4172 4173 created: int 4174 num groups created, 1 == success 4175 4176 added: int 4177 num portfolios added to the group, should match the length of 'portfolios' argument 4178 } 4179 4180 """ 4181 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4182 return client.create_portfolio_group(group_name, portfolios)
Create a new portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_name: str name of the new group
portfolios: List of Dict [:
portfolio_id: str
rank_in_group: Optional[int] = None
]
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict: {
group_id: str
UUID identifier for the portfolio group
created: int
num groups created, 1 == success
added: int
num portfolios added to the group, should match the length of 'portfolios' argument
}
4185def renamePortfolioGroup( 4186 apikey: str, 4187 group_id: str, 4188 group_name: str, 4189 proxy: Optional[str] = None, 4190 disable_verify_ssl: bool = False, 4191) -> Dict: 4192 """ 4193 Rename a portfolio group 4194 4195 Parameters 4196 ---------- 4197 apikey: str 4198 API key provided by Boosted. This key should be protected as a secret. 4199 4200 group_id: str, 4201 UUID str identifying a portfolio group 4202 4203 group_name: str, 4204 The new name for the porfolio 4205 4206 proxy: str 4207 Your organization may require the use of a proxy for access. 4208 The address of a HTTPS proxy in the format of <address>:<port>. 4209 Examples are "123.456.789:123" or "my.proxy.com:123". 4210 Do not prepend with "https://". 4211 disable_verify_ssl: bool 4212 Your networking setup may be behind a firewall which performs SSL 4213 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4214 to point to the location of a custom certificate bundle, or set this 4215 parameter to true to disable SSL verification as a workaround. 4216 4217 Returns: 4218 ------- 4219 Dict { 4220 changed: int - 1 == success 4221 } 4222 """ 4223 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4224 return client.rename_portfolio_group(group_id, group_name)
Rename a portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str, UUID str identifying a portfolio group
group_name: str, The new name for the porfolio
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict {
changed: int - 1 == success
}
4227def addToPortfolioGroup( 4228 apikey: str, 4229 group_id: str, 4230 portfolios: List[Dict], 4231 proxy: Optional[str] = None, 4232 disable_verify_ssl: bool = False, 4233) -> Dict: 4234 """ 4235 Add portfolios to a group 4236 4237 Parameters 4238 ---------- 4239 apikey: str 4240 API key provided by Boosted. This key should be protected as a secret. 4241 4242 group_id: str, 4243 UUID str identifying a portfolio group 4244 4245 portfolios: List of Dict [: 4246 portfolio_id: str 4247 rank_in_group: Optional[int] = None 4248 ] 4249 4250 4251 proxy: str 4252 Your organization may require the use of a proxy for access. 4253 The address of a HTTPS proxy in the format of <address>:<port>. 4254 Examples are "123.456.789:123" or "my.proxy.com:123". 4255 Do not prepend with "https://". 4256 disable_verify_ssl: bool 4257 Your networking setup may be behind a firewall which performs SSL 4258 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4259 to point to the location of a custom certificate bundle, or set this 4260 parameter to true to disable SSL verification as a workaround. 4261 4262 4263 Returns: 4264 ------- 4265 Dict { 4266 added: int 4267 number of successful changes 4268 } 4269 """ 4270 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4271 return client.add_to_portfolio_group(group_id, portfolios)
Add portfolios to a group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str,
UUID str identifying a portfolio group
portfolios: List of Dict [:
portfolio_id: str
rank_in_group: Optional[int] = None
]
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict { added: int number of successful changes }
4274def removeFromPortfolioGroup( 4275 apikey: str, 4276 group_id: str, 4277 portfolios: List[str], 4278 proxy: Optional[str] = None, 4279 disable_verify_ssl: bool = False, 4280) -> Dict: 4281 """ 4282 Remove portfolios from a group 4283 4284 Parameters 4285 ---------- 4286 apikey: str 4287 API key provided by Boosted. This key should be protected as a secret. 4288 4289 group_id: str, 4290 UUID str identifying a portfolio group 4291 4292 portfolios: List of str 4293 4294 4295 proxy: str 4296 Your organization may require the use of a proxy for access. 4297 The address of a HTTPS proxy in the format of <address>:<port>. 4298 Examples are "123.456.789:123" or "my.proxy.com:123". 4299 Do not prepend with "https://". 4300 disable_verify_ssl: bool 4301 Your networking setup may be behind a firewall which performs SSL 4302 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4303 to point to the location of a custom certificate bundle, or set this 4304 parameter to true to disable SSL verification as a workaround. 4305 4306 4307 Returns: 4308 ------- 4309 Dict { 4310 removed: int 4311 number of successful changes 4312 } 4313 """ 4314 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4315 return client.remove_from_portfolio_group(group_id, portfolios)
Remove portfolios from a group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str, UUID str identifying a portfolio group
portfolios: List of str
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns:
Dict { removed: int number of successful changes }
4318def deletePortfolioGroup( 4319 apikey: str, 4320 group_id: str, 4321 proxy: Optional[str] = None, 4322 disable_verify_ssl: bool = False, 4323) -> Dict: 4324 """ 4325 Delete a portfolio group 4326 4327 Parameters 4328 ---------- 4329 4330 apikey: str 4331 API key provided by Boosted. This key should be protected as a secret. 4332 4333 group_id: str, 4334 UUID str identifying a portfolio group 4335 4336 proxy: str 4337 Your organization may require the use of a proxy for access. 4338 The address of a HTTPS proxy in the format of <address>:<port>. 4339 Examples are "123.456.789:123" or "my.proxy.com:123". 4340 Do not prepend with "https://". 4341 disable_verify_ssl: bool 4342 Your networking setup may be behind a firewall which performs SSL 4343 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4344 to point to the location of a custom certificate bundle, or set this 4345 parameter to true to disable SSL verification as a workaround. 4346 4347 Returns 4348 ------- 4349 4350 Dict { 4351 removed_groups: int 4352 number of successful changes 4353 4354 removed_portfolios: int 4355 number of successful changes 4356 } 4357 4358 """ 4359 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4360 return client.delete_portfolio_group(group_id)
Delete a portfolio group
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret.
group_id: str, UUID str identifying a portfolio group
proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dict {
removed_groups: int
number of successful changes
removed_portfolios: int
number of successful changes
}
4363def getRiskGroups( 4364 apikey: str, 4365 model_id: str, 4366 portfolio_id: str, 4367 date: BoostedDate = datetime.date.today(), 4368 proxy: Optional[str] = None, 4369 disable_verify_ssl: bool = False, 4370 use_v2: bool = False, 4371) -> List[Dict[str, Any]]: 4372 """ 4373 Given a model and portfolio, returns the calculated semantic risk groups. 4374 4375 Parameters 4376 ---------- 4377 apikey: str 4378 API key provided by Boosted. This key should be protected as a secret. 4379 model_id: str 4380 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4381 button next to your model's name in the Model Summary Page in Boosted 4382 Insights. 4383 portfolio_id: str 4384 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4385 date: datetime.date | str 4386 Date for which to fetch data. Defaults to "today". 4387 use_v2: bool 4388 Whether to use the "V2" version of risk factors data. 4389 proxy: str 4390 Your organization may require the use of a proxy for access. 4391 The address of a HTTPS proxy in the format of <address>:<port>. 4392 Examples are "123.456.789:123" or "my.proxy.com:123". 4393 Do not prepend with "https://". 4394 disable_verify_ssl: bool 4395 Your networking setup may be behind a firewall which performs SSL 4396 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4397 to point to the location of a custom certificate bundle, or set this 4398 parameter to true to disable SSL verification as a workaround. 4399 4400 Returns 4401 ------- 4402 A list of dictionaries. Each dictionary has the following keys: 4403 machine: int 4404 E.g. 1 for "machine_1", 2 for "machine_2", etc. 4405 risk_group_a: List[str] 4406 List of stock descriptors risk group a (e.g. Cruises, Airlines, etc.) 4407 risk_group_b: List[str] 4408 List of stock descriptors risk group b (e.g. Cruises, Airlines, etc.) 4409 volatility_explained: float 4410 Decimal between 0.0 and 1.0 that represents the percent of stock 4411 universe volatility explained by these groups. 4412 """ 4413 date = convert_date(date) 4414 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4415 return client.get_risk_groups(model_id, portfolio_id, date, use_v2)
Given a model and portfolio, returns the calculated semantic risk groups.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch data. Defaults to "today". use_v2: bool Whether to use the "V2" version of risk factors data. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of dictionaries. Each dictionary has the following keys: machine: int E.g. 1 for "machine_1", 2 for "machine_2", etc. risk_group_a: List[str] List of stock descriptors risk group a (e.g. Cruises, Airlines, etc.) risk_group_b: List[str] List of stock descriptors risk group b (e.g. Cruises, Airlines, etc.) volatility_explained: float Decimal between 0.0 and 1.0 that represents the percent of stock universe volatility explained by these groups.
4418def getRiskFactorsDiscoveredDescriptors( 4419 apikey: str, 4420 model_id: str, 4421 portfolio_id: str, 4422 date: BoostedDate = datetime.date.today(), 4423 proxy: Optional[str] = None, 4424 disable_verify_ssl: bool = False, 4425 use_v2: bool = False, 4426) -> pd.DataFrame: 4427 """ 4428 Given a model and portfolio, returns the calculated semantic risk discovered 4429 descriptors. 4430 4431 Parameters 4432 ---------- 4433 apikey: str 4434 API key provided by Boosted. This key should be protected as a secret. 4435 model_id: str 4436 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4437 button next to your model's name in the Model Summary Page in Boosted 4438 Insights. 4439 portfolio_id: str 4440 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4441 date: datetime.date | str 4442 Date for which to fetch data. Defaults to "today". 4443 use_v2: bool 4444 Whether to use the "V2" version of risk factors data. 4445 proxy: str 4446 Your organization may require the use of a proxy for access. 4447 The address of a HTTPS proxy in the format of <address>:<port>. 4448 Examples are "123.456.789:123" or "my.proxy.com:123". 4449 Do not prepend with "https://". 4450 disable_verify_ssl: bool 4451 Your networking setup may be behind a firewall which performs SSL 4452 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4453 to point to the location of a custom certificate bundle, or set this 4454 parameter to true to disable SSL verification as a workaround. 4455 4456 Returns 4457 ------- 4458 A dataframe with the following columns: 4459 4460 level: int 4461 An integer indicating the depth/level of that row (0 for sectors, 1 for 4462 securities). 4463 identifier: str 4464 Sector/security identifier. 4465 stock_count: int 4466 Total number of stocks in the sector/industry. For security rows, will 4467 be 1. 4468 volatility: float 4469 exposure: float 4470 rating: float 4471 rating_delta: float 4472 """ 4473 date = convert_date(date) 4474 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4475 return client.get_risk_factors_discovered_descriptors(model_id, portfolio_id, date, use_v2)
Given a model and portfolio, returns the calculated semantic risk discovered descriptors.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch data. Defaults to "today". use_v2: bool Whether to use the "V2" version of risk factors data. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dataframe with the following columns:
level: int An integer indicating the depth/level of that row (0 for sectors, 1 for securities). identifier: str Sector/security identifier. stock_count: int Total number of stocks in the sector/industry. For security rows, will be 1. volatility: float exposure: float rating: float rating_delta: float
4478def getRiskFactorsSectors( 4479 apikey: str, 4480 model_id: str, 4481 portfolio_id: str, 4482 date: BoostedDate = datetime.date.today(), 4483 proxy: Optional[str] = None, 4484 disable_verify_ssl: bool = False, 4485 use_v2: bool = False, 4486) -> pd.DataFrame: 4487 """ 4488 Given a model and portfolio, returns the calculated semantic risk sectors. 4489 4490 Parameters 4491 ---------- 4492 apikey: str 4493 API key provided by Boosted. This key should be protected as a secret. 4494 model_id: str 4495 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4496 button next to your model's name in the Model Summary Page in Boosted 4497 Insights. 4498 portfolio_id: str 4499 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4500 date: datetime.date | str 4501 Date for which to fetch data. Defaults to "today". 4502 use_v2: bool 4503 Whether to use the "V2" version of risk factors data. 4504 proxy: str 4505 Your organization may require the use of a proxy for access. 4506 The address of a HTTPS proxy in the format of <address>:<port>. 4507 Examples are "123.456.789:123" or "my.proxy.com:123". 4508 Do not prepend with "https://". 4509 disable_verify_ssl: bool 4510 Your networking setup may be behind a firewall which performs SSL 4511 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4512 to point to the location of a custom certificate bundle, or set this 4513 parameter to true to disable SSL verification as a workaround. 4514 4515 Returns 4516 ------- 4517 A dataframe with the following columns: 4518 4519 level: int 4520 An integer indicating the depth/level of that row (0 for sectors, 1 for 4521 industry groups, 2 for industries). 4522 identifier: str 4523 Sector/Industry group/Industry identifier. 4524 stock_count: int 4525 Total number of stocks in the sector/industry. 4526 volatility: float 4527 exposure: float 4528 rating: float 4529 rating_delta: float 4530 """ 4531 date = convert_date(date) 4532 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4533 return client.get_risk_factors_sectors(model_id, portfolio_id, date, use_v2)
Given a model and portfolio, returns the calculated semantic risk sectors.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. date: datetime.date | str Date for which to fetch data. Defaults to "today". use_v2: bool Whether to use the "V2" version of risk factors data. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dataframe with the following columns:
level: int An integer indicating the depth/level of that row (0 for sectors, 1 for industry groups, 2 for industries). identifier: str Sector/Industry group/Industry identifier. stock_count: int Total number of stocks in the sector/industry. volatility: float exposure: float rating: float rating_delta: float
4536def downloadCompletePortfolioData( 4537 apikey: str, 4538 model_id: str, 4539 portfolio_id: str, 4540 download_filepath: Optional[str] = None, 4541 proxy: Optional[str] = None, 4542 disable_verify_ssl: bool = False, 4543): 4544 """ 4545 Given a model and portfolio, downloads the complete portfolio data as an 4546 excel file to the specified download path. 4547 4548 Parameters 4549 ---------- 4550 apikey: str 4551 API key provided by Boosted. This key should be protected as a secret. 4552 model_id: str 4553 Model ID. Model IDs can be retrieved by clicking on the copy to clipboard 4554 button next to your model's name in the Model Summary Page in Boosted 4555 Insights. 4556 portfolio_id: str 4557 Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. 4558 download_filepath: Optional[str] 4559 File path to download model data file to. If not present, will default 4560 to a file named after the model_id in the current directory. 4561 proxy: str 4562 Your organization may require the use of a proxy for access. 4563 The address of a HTTPS proxy in the format of <address>:<port>. 4564 Examples are "123.456.789:123" or "my.proxy.com:123". 4565 Do not prepend with "https://". 4566 disable_verify_ssl: bool 4567 Your networking setup may be behind a firewall which performs SSL 4568 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4569 to point to the location of a custom certificate bundle, or set this 4570 parameter to true to disable SSL verification as a workaround. 4571 """ 4572 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4573 if download_filepath is None: 4574 download_filepath = f"{model_id}.xlsx" 4575 client.download_complete_portfolio_data(model_id, portfolio_id, download_filepath)
Given a model and portfolio, downloads the complete portfolio data as an excel file to the specified download path.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str Model ID. Model IDs can be retrieved by clicking on the copy to clipboard button next to your model's name in the Model Summary Page in Boosted Insights. portfolio_id: str Portfolio ID. Portfolio IDs can be retrieved from portfolio's configuration page. download_filepath: Optional[str] File path to download model data file to. If not present, will default to a file named after the model_id in the current directory. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:4578def diffHedgeExperimentPortfolioData( 4579 apikey: str, 4580 experiment_id: str, 4581 comparison_portfolios: List[str], 4582 categories: Optional[List[str]] = None, 4583 proxy: Optional[str] = None, 4584 disable_verify_ssl: bool = False, 4585) -> Dict: 4586 """ 4587 Differences portfolios, returning data relative to the baseline. 4588 4589 This function supports differencing multiple portfolios against the 4590 baseline, such that diff_i = cmp_pf_i - baseline. Differences are 4591 calculated element-wise on a per-category basis. 4592 4593 Currently, this function only works for hedge experiment portfolios. 4594 4595 Parameters 4596 ---------- 4597 apikey: str 4598 API key provided by Boosted. This key should be protected as a secret. 4599 experiment_id: str 4600 Hedge experiment id 4601 comparison_portfolios: List[str] 4602 List of portfolios to be diffed against the current baseline. 4603 categories: List[str] 4604 Specifier of what data to difference. Passing a smaller, desired 4605 subset can improve performance. Options include: 4606 ["performanceGrid", "performance", "factors", "volatility"] 4607 proxy: str 4608 Your organization may require the use of a proxy for access. 4609 The address of a HTTPS proxy in the format of <address>:<port>. 4610 Examples are "123.456.789:123" or "my.proxy.com:123". 4611 Do not prepend with "https://". 4612 disable_verify_ssl: bool 4613 Your networking setup may be behind a firewall which performs SSL 4614 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4615 to point to the location of a custom certificate bundle, or set this 4616 parameter to true to disable SSL verification as a workaround. 4617 4618 Returns 4619 ------- 4620 Dictionary: 4621 { 4622 "factors": Optional[pd.DataFrame], 4623 "volatility":Optional[pd.DataFrame], 4624 "performance": Optional[pd.DataFrame], 4625 "performanceGrid": Optional[pd.DataFrame] 4626 } 4627 """ 4628 4629 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4630 DIFF_CATEGORIES = ["performance", "performanceGrid", "volatility", "factors"] 4631 if categories is None: 4632 categories = DIFF_CATEGORIES 4633 else: 4634 for cat in categories: 4635 if cat not in DIFF_CATEGORIES: 4636 raise ValueError(f"Unexpected category {cat}") 4637 diff = client.diff_hedge_experiment_portfolio_data( 4638 experiment_id, comparison_portfolios, categories 4639 ) 4640 return diff
Differences portfolios, returning data relative to the baseline.
This function supports differencing multiple portfolios against the baseline, such that diff_i = cmp_pf_i - baseline. Differences are calculated element-wise on a per-category basis.
Currently, this function only works for hedge experiment portfolios.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. experiment_id: str Hedge experiment id comparison_portfolios: List[str] List of portfolios to be diffed against the current baseline. categories: List[str] Specifier of what data to difference. Passing a smaller, desired subset can improve performance. Options include: ["performanceGrid", "performance", "factors", "volatility"] proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary: { "factors": Optional[pd.DataFrame], "volatility":Optional[pd.DataFrame], "performance": Optional[pd.DataFrame], "performanceGrid": Optional[pd.DataFrame] }
4643def getSignalStrength( 4644 apikey: str, 4645 model_id: str, 4646 portfolio_id: str, 4647 proxy: Optional[str] = None, 4648 disable_verify_ssl: bool = False, 4649) -> pd.DataFrame: 4650 """ 4651 Retrieves portfolio signals data and returns as a pandas dataframe. 4652 4653 Parameters 4654 ---------- 4655 apikey: str 4656 API key provided by Boosted. This key should be protected as a secret. 4657 model_id: str 4658 UUID of a Boosted model. 4659 portfolio_id: str 4660 UUID of a Boosted portfolio in the given model. 4661 proxy: str 4662 Your organization may require the use of a proxy for access. 4663 The address of a HTTPS proxy in the format of <address>:<port>. 4664 Examples are "123.456.789:123" or "my.proxy.com:123". 4665 Do not prepend with "https://". 4666 disable_verify_ssl: bool 4667 Your networking setup may be behind a firewall which performs SSL 4668 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4669 to point to the location of a custom certificate bundle, or set this 4670 parameter to true to disable SSL verification as a workaround. 4671 4672 Returns 4673 ------- 4674 Pandas Dataframe indexed by date with columns: 4675 5D, 10D, 21D, 63D, 126D, 189D, 252D, 315D, 378D, 441D, 504D, TimeHorizon 4676 """ 4677 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4678 return client.get_signal_strength(model_id, portfolio_id)
Retrieves portfolio signals data and returns as a pandas dataframe.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by date with columns: 5D, 10D, 21D, 63D, 126D, 189D, 252D, 315D, 378D, 441D, 504D, TimeHorizon
4681def getRollingSignalStrength( 4682 apikey: str, 4683 model_id: str, 4684 portfolio_id: str, 4685 proxy: Optional[str] = None, 4686 disable_verify_ssl: bool = False, 4687): 4688 """ 4689 Retrieves portfolio rolling signals data and returns as a pandas dataframe. 4690 4691 Parameters 4692 ---------- 4693 apikey: str 4694 API key provided by Boosted. This key should be protected as a secret. 4695 model_id: str 4696 UUID of a Boosted model. 4697 portfolio_id: str 4698 UUID of a Boosted portfolio in the given model. 4699 proxy: str 4700 Your organization may require the use of a proxy for access. 4701 The address of a HTTPS proxy in the format of <address>:<port>. 4702 Examples are "123.456.789:123" or "my.proxy.com:123". 4703 Do not prepend with "https://". 4704 disable_verify_ssl: bool 4705 Your networking setup may be behind a firewall which performs SSL 4706 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4707 to point to the location of a custom certificate bundle, or set this 4708 parameter to true to disable SSL verification as a workaround. 4709 4710 Returns 4711 ------- 4712 Pandas Dataframe indexed by date with columns: 4713 Avg5D 4714 Avg10D 4715 Avg21D 4716 Avg63D 4717 Avg126D 4718 Avg189D 4719 Avg252D 4720 Avg315D 4721 Avg378D 4722 Avg441D 4723 Avg504D 4724 Avgtime Horizon 4725 """ 4726 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4727 return client.get_rolling_signal_strength(model_id, portfolio_id)
Retrieves portfolio rolling signals data and returns as a pandas dataframe.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by date with columns: Avg5D Avg10D Avg21D Avg63D Avg126D Avg189D Avg252D Avg315D Avg378D Avg441D Avg504D Avgtime Horizon
4730def getPortfolioFactorAttribution( 4731 apikey: str, 4732 portfolio_id: str, 4733 start_date: Optional[BoostedDate] = None, 4734 end_date: Optional[BoostedDate] = None, 4735 proxy: Optional[str] = None, 4736 disable_verify_ssl: bool = False, 4737): 4738 """Get factor attribution for a portfolio. 4739 Factor attribution is the methodology of using a stock or strategy’s 4740 factor exposure to explain its risk and reward. 4741 4742 Patameters 4743 ---------- 4744 apikey: str : 4745 API key provided by Boosted. This key should be protected as a secret. 4746 portfolio_id: str 4747 UUID of a Boosted portfolio in the given model. 4748 start_date: datetime.date | str 4749 Starting date for which trades should be fetched. 4750 Default to the first date of the portfolio. 4751 end_date: datetime.date | str 4752 Ending date for which trades should be fetched. 4753 Default to the latest date of the portfolio. 4754 proxy: str 4755 Your organization may require the use of a proxy for access. 4756 The address of a HTTPS proxy in the format of <address>:<port>. 4757 Examples are "123.456.789:123" or "my.proxy.com:123". 4758 Do not prepend with "https://". 4759 disable_verify_ssl: bool 4760 Your networking setup may be behind a firewall which performs SSL 4761 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4762 to point to the location of a custom certificate bundle, or set this 4763 parameter to true to disable SSL verification as a workaround. 4764 4765 Returns 4766 ------- 4767 A Pandas Dataframe indexed by date with each factor attribution per column. 4768 The <factor attribution>_return columns are percentages. 4769 For example, 0.05 of `volatility_return` means the return for volatility is 0.05%. 4770 """ 4771 client = BoostedClient(api_key=apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4772 return client.get_portfolio_factor_attribution( 4773 portfolio_id=portfolio_id, 4774 start_date=start_date, 4775 end_date=end_date, 4776 )
Get factor attribution for a portfolio. Factor attribution is the methodology of using a stock or strategy’s factor exposure to explain its risk and reward.
Patameters
apikey: str : API key provided by Boosted. This key should be protected as a secret. portfolio_id: str UUID of a Boosted portfolio in the given model. start_date: datetime.date | str Starting date for which trades should be fetched. Default to the first date of the portfolio. end_date: datetime.date | str Ending date for which trades should be fetched. Default to the latest date of the portfolio. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A Pandas Dataframe indexed by date with each factor attribution per column.
The volatility_return
means the return for volatility is 0.05%.
4779def getPortfolioQuantiles( 4780 apikey: str, 4781 model_id: str, 4782 portfolio_id: str, 4783 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4784 proxy: Optional[str] = None, 4785 disable_verify_ssl: bool = False, 4786): 4787 """ 4788 Get quantile data for a portfolio. 4789 4790 Parameters 4791 ---------- 4792 apikey: str 4793 API key provided by Boosted. This key should be protected as a secret. 4794 model_id: str 4795 UUID of a Boosted model. 4796 portfolio_id: str 4797 UUID of a Boosted portfolio in the given model. 4798 id_type: Literal["TICKER", "ISIN"] = "TICKER", 4799 Whether the column names are ISIN's or tickers in the output dataframe. 4800 proxy: str 4801 Your organization may require the use of a proxy for access. 4802 The address of a HTTPS proxy in the format of <address>:<port>. 4803 Examples are "123.456.789:123" or "my.proxy.com:123". 4804 Do not prepend with "https://". 4805 disable_verify_ssl: bool 4806 Your networking setup may be behind a firewall which performs SSL 4807 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4808 to point to the location of a custom certificate bundle, or set this 4809 parameter to true to disable SSL verification as a workaround. 4810 4811 Returns 4812 ------- 4813 Pandas Dataframe indexed by date with each one security per column. 4814 """ 4815 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4816 return client.get_portfolio_quantiles( 4817 model_id=model_id, 4818 portfolio_id=portfolio_id, 4819 id_type=id_type, 4820 )
Get quantile data for a portfolio.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. id_type: Literal["TICKER", "ISIN"] = "TICKER", Whether the column names are ISIN's or tickers in the output dataframe. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by date with each one security per column.
4823def getSimilarStocks( 4824 apikey: str, 4825 model_id: str, 4826 portfolio_id: str, 4827 identifiers: List[str], 4828 date: BoostedDate, 4829 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4830 proxy: Optional[str] = None, 4831 disable_verify_ssl: bool = False, 4832 preferred_country: Optional[str] = None, 4833 preferred_currency: Optional[str] = None, 4834) -> pd.DataFrame: 4835 """ 4836 Get the stock similarity data for a basket of stocks. 4837 4838 Parameters 4839 ---------- 4840 apikey: str 4841 API key provided by Boosted. This key should be protected as a secret. 4842 model_id: str 4843 UUID of a Boosted model. 4844 portfolio_id: str 4845 UUID of a Boosted portfolio in the given model. 4846 identifiers: List[str] 4847 List of identifiers that represent the input basket of stocks, can be 4848 either ISIN's or Tickers. 4849 date: Optional[datetime.date | str] 4850 Date for which similarity data should be fetched. 4851 identifier_type: Literal["TICKER", "ISIN"] = "TICKER", 4852 Should be set to whatever identifier type is input. Defaults to TICKER. 4853 preferred_country: str 4854 The preferred country for the identifier list, to resolve 4855 abiguities. Should be a 3 character iso code. By default, will try to 4856 figure out the best match. 4857 preferred_currency: str 4858 The preferred currency for the identifier list, to resolve 4859 abiguities. Should be a 3 character iso code. By default, will try to 4860 figure out the best match. 4861 proxy: str 4862 Your organization may require the use of a proxy for access. 4863 The address of a HTTPS proxy in the format of <address>:<port>. 4864 Examples are "123.456.789:123" or "my.proxy.com:123". 4865 Do not prepend with "https://". 4866 disable_verify_ssl: bool 4867 Your networking setup may be behind a firewall which performs SSL 4868 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4869 to point to the location of a custom certificate bundle, or set this 4870 parameter to true to disable SSL verification as a workaround. 4871 4872 Returns 4873 ------- 4874 Pandas Dataframe indexed by identifier with a row for every security in the 4875 portfolio (except for those in the input basket). DataFrame will contain 4876 columns: 4877 - overallSimilarityScore: float 4878 - priceSimilarityScore: float 4879 - factorSimilarityScore: float 4880 - correlation: float 4881 """ 4882 4883 if identifier_type not in ["TICKER", "ISIN"]: 4884 raise ValueError( 4885 f"Got unexpected value for arg {identifier_type=}; expected 'TICKER' or 'ISIN'" 4886 ) 4887 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4888 return client.get_similar_stocks( 4889 model_id=model_id, 4890 portfolio_id=portfolio_id, 4891 symbol_list=identifiers, 4892 date=date, 4893 identifier_type=identifier_type, 4894 preferred_country=preferred_country, 4895 preferred_currency=preferred_currency, 4896 )
Get the stock similarity data for a basket of stocks.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. identifiers: List[str] List of identifiers that represent the input basket of stocks, can be either ISIN's or Tickers. date: Optional[datetime.date | str] Date for which similarity data should be fetched. identifier_type: Literal["TICKER", "ISIN"] = "TICKER", Should be set to whatever identifier type is input. Defaults to TICKER. preferred_country: str The preferred country for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. preferred_currency: str The preferred currency for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe indexed by identifier with a row for every security in the portfolio (except for those in the input basket). DataFrame will contain columns:
- overallSimilarityScore: float
- priceSimilarityScore: float
- factorSimilarityScore: float
- correlation: float
4899def getPortfolioTrades( 4900 apikey: str, 4901 model_id: str, 4902 portfolio_id: str, 4903 start_date: Optional[BoostedDate] = None, 4904 end_date: Optional[BoostedDate] = None, 4905 proxy: Optional[str] = None, 4906 disable_verify_ssl: bool = False, 4907) -> pd.DataFrame: 4908 """ 4909 Get the list of trades for a portfolio. NOTE: The max date range is 7 years, 4910 any larger will return an error. 4911 4912 Parameters 4913 ---------- 4914 apikey: str 4915 API key provided by Boosted. This key should be protected as a secret. 4916 model_id: str 4917 UUID of a Boosted model. 4918 portfolio_id: str 4919 UUID of a Boosted portfolio in the given model. 4920 start_date: Optional[datetime.date | str] 4921 Starting date for which trades should be fetched. 4922 end_date: Optional[datetime.date | str] 4923 Ending date for which trades should be fetched. 4924 proxy: str 4925 Your organization may require the use of a proxy for access. 4926 The address of a HTTPS proxy in the format of <address>:<port>. 4927 Examples are "123.456.789:123" or "my.proxy.com:123". 4928 Do not prepend with "https://". 4929 disable_verify_ssl: bool 4930 Your networking setup may be behind a firewall which performs SSL 4931 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4932 to point to the location of a custom certificate bundle, or set this 4933 parameter to true to disable SSL verification as a workaround. 4934 4935 Returns 4936 ------- 4937 Pandas Dataframe, each row containing data for a security + date. 4938 Columns are: 4939 - isin: str 4940 - ticker: str 4941 - date: datetime.date 4942 - price: float 4943 - shares_owned: float 4944 - shares_traded: float 4945 """ 4946 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 4947 return client.get_portfolio_trades( 4948 model_id=model_id, 4949 portfolio_id=portfolio_id, 4950 start_date=start_date, 4951 end_date=end_date, 4952 )
Get the list of trades for a portfolio. NOTE: The max date range is 7 years, any larger will return an error.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. start_date: Optional[datetime.date | str] Starting date for which trades should be fetched. end_date: Optional[datetime.date | str] Ending date for which trades should be fetched. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe, each row containing data for a security + date. Columns are:
- isin: str
- ticker: str
- date: datetime.date
- price: float
- shares_owned: float
- shares_traded: float
4955def getIdeas( 4956 apikey: str, 4957 model_id: str, 4958 portfolio_id: str, 4959 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 4960 delta_horizon: Literal["1M", "3M", "6M", "9M", "1Y"] = "1M", 4961 proxy: Optional[str] = None, 4962 disable_verify_ssl: bool = False, 4963) -> pd.DataFrame: 4964 """ 4965 Given a model ID, portfolio ID, and a time horizon, return a dataframe of 4966 stock ideas. 4967 4968 Parameters 4969 ---------- 4970 apikey: str 4971 API key provided by Boosted. This key should be protected as a secret. 4972 model_id: str 4973 UUID of a Boosted model. 4974 portfolio_id: str 4975 UUID of a Boosted portfolio in the given model. 4976 investment_horizon: str 4977 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 4978 delta_horizon: str 4979 Time period over which to compute deltas. Can be "1M", "3M", "6M", "9M", "1Y". 4980 proxy: str 4981 Your organization may require the use of a proxy for access. 4982 The address of a HTTPS proxy in the format of <address>:<port>. 4983 Examples are "123.456.789:123" or "my.proxy.com:123". 4984 Do not prepend with "https://". 4985 disable_verify_ssl: bool 4986 Your networking setup may be behind a firewall which performs SSL 4987 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 4988 to point to the location of a custom certificate bundle, or set this 4989 parameter to true to disable SSL verification as a workaround. 4990 4991 Returns 4992 ------- 4993 Pandas Dataframe, each row containing data for a security. The dataframe is 4994 indexed by ticker. 4995 Columns are: 4996 - recommendation: str 4997 - rating: float 4998 - rating_delta: float 4999 - dividend_yield: float 5000 - predicted_excess_return_1m: float 5001 - predicted_excess_return_3m: float 5002 - predicted_excess_return_1y: float 5003 - risk: str 5004 - reward: str 5005 - reason: str 5006 """ 5007 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5008 return client.get_ideas( 5009 model_id=model_id, 5010 portfolio_id=portfolio_id, 5011 investment_horizon=investment_horizon, 5012 delta_horizon=delta_horizon, 5013 )
Given a model ID, portfolio ID, and a time horizon, return a dataframe of stock ideas.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. investment_horizon: str Investment time horizon for the ideas. Can be "1M", "3M", "1Y". delta_horizon: str Time period over which to compute deltas. Can be "1M", "3M", "6M", "9M", "1Y". proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe, each row containing data for a security. The dataframe is indexed by ticker. Columns are:
- recommendation: str
- rating: float
- rating_delta: float
- dividend_yield: float
- predicted_excess_return_1m: float
- predicted_excess_return_3m: float
- predicted_excess_return_1y: float
- risk: str
- reward: str
- reason: str
5016def getStockRecommendations( 5017 apikey: str, 5018 model_id: str, 5019 portfolio_id: str, 5020 symbols: Optional[List[str]] = None, 5021 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5022 proxy: Optional[str] = None, 5023 disable_verify_ssl: bool = False, 5024) -> pd.DataFrame: 5025 """ 5026 Given a model ID, portfolio ID, optional list of symbols, and a time 5027 horizon, return a dictionary of symbols to stock recommendations. 5028 5029 Parameters 5030 ---------- 5031 apikey: str 5032 API key provided by Boosted. This key should be protected as a secret. 5033 model_id: str 5034 UUID of a Boosted model. 5035 portfolio_id: str 5036 UUID of a Boosted portfolio in the given model. 5037 symbols: Optional[List[str]] 5038 List of symbols for which to fetch recommendation info. If None, will 5039 return recommendations for the entire portfolio. Note that invalid 5040 symbols or symbols without recommendations will not be returned. 5041 investment_horizon: str 5042 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5043 proxy: str 5044 Your organization may require the use of a proxy for access. 5045 The address of a HTTPS proxy in the format of <address>:<port>. 5046 Examples are "123.456.789:123" or "my.proxy.com:123". 5047 Do not prepend with "https://". 5048 disable_verify_ssl: bool 5049 Your networking setup may be behind a firewall which performs SSL 5050 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5051 to point to the location of a custom certificate bundle, or set this 5052 parameter to true to disable SSL verification as a workaround. 5053 5054 Returns 5055 ------- 5056 Pandas Dataframe, each row containing data for a security. The dataframe is 5057 indexed by ticker. The "reasons" column is a dict from a reason's "title" to 5058 its text. 5059 Columns are: 5060 - recommendation: str 5061 - predicted_excess_return_1m: float 5062 - predicted_excess_return_3m: float 5063 - predicted_excess_return_1y: float 5064 - risk: str 5065 - reward: str 5066 - reasons: Dict[str, str] 5067 """ 5068 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5069 return client.get_stock_recommendations( 5070 model_id=model_id, 5071 portfolio_id=portfolio_id, 5072 symbols=symbols, 5073 investment_horizon=investment_horizon, 5074 )
Given a model ID, portfolio ID, optional list of symbols, and a time horizon, return a dictionary of symbols to stock recommendations.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. symbols: Optional[List[str]] List of symbols for which to fetch recommendation info. If None, will return recommendations for the entire portfolio. Note that invalid symbols or symbols without recommendations will not be returned. investment_horizon: str Investment time horizon for the ideas. Can be "1M", "3M", "1Y". proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Pandas Dataframe, each row containing data for a security. The dataframe is indexed by ticker. The "reasons" column is a dict from a reason's "title" to its text. Columns are:
- recommendation: str
- predicted_excess_return_1m: float
- predicted_excess_return_3m: float
- predicted_excess_return_1y: float
- risk: str
- reward: str
- reasons: Dict[str, str]
5077def getStockRecommendationReasons( 5078 apikey: str, 5079 model_id: str, 5080 portfolio_id: str, 5081 investment_horizon: Literal["1M", "3M", "1Y"] = "1M", 5082 symbols: Optional[List[str]] = None, 5083 proxy: Optional[str] = None, 5084 disable_verify_ssl: bool = False, 5085) -> Dict[str, Optional[List[str]]]: 5086 """ 5087 Given a model ID, portfolio ID, symbols, and a time horizon, return a dictionary 5088 of symbols to stock recommendations. 5089 5090 Parameters 5091 ---------- 5092 apikey: str 5093 API key provided by Boosted. This key should be protected as a secret. 5094 model_id: str 5095 UUID of a Boosted model. 5096 portfolio_id: str 5097 UUID of a Boosted portfolio in the given model. 5098 symbols: List[str] 5099 Optional list of symbols for which to fetch reasons. If None, all symbols 5100 for the given portfolio are fetched. 5101 investment_horizon: str 5102 Investment time horizon for the ideas. Can be "1M", "3M", "1Y". 5103 proxy: str 5104 Your organization may require the use of a proxy for access. 5105 The address of a HTTPS proxy in the format of <address>:<port>. 5106 Examples are "123.456.789:123" or "my.proxy.com:123". 5107 Do not prepend with "https://". 5108 disable_verify_ssl: bool 5109 Your networking setup may be behind a firewall which performs SSL 5110 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5111 to point to the location of a custom certificate bundle, or set this 5112 parameter to true to disable SSL verification as a workaround. 5113 5114 Returns 5115 ------- 5116 Dictionary: 5117 { 5118 <symbol_0>: [reason_0, reason_1, ...], 5119 <symbol_1>: [reason_0, reason_1, ...] 5120 } 5121 Note that for a passed symbol that has no reasons, the symbol will be present 5122 in the dictionary but will not have any elements in its list, i.e. 5123 >>> print(result["SOME_SYMBOL_WITH_NO_REASONS"]) 5124 [] 5125 Additionally, if a passed symbol is not found as a portfolio holding, the symbol 5126 will be present in the dictionary but will be valued None, i.e. 5127 >>> print(result["SOME_SYMBOL_NOT_FOUND"]) 5128 None 5129 """ 5130 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5131 return client.get_stock_recommendation_reasons( 5132 model_id=model_id, 5133 portfolio_id=portfolio_id, 5134 investment_horizon=investment_horizon, 5135 symbols=symbols, 5136 )
Given a model ID, portfolio ID, symbols, and a time horizon, return a dictionary of symbols to stock recommendations.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: str UUID of a Boosted model. portfolio_id: str UUID of a Boosted portfolio in the given model. symbols: List[str] Optional list of symbols for which to fetch reasons. If None, all symbols for the given portfolio are fetched. investment_horizon: str Investment time horizon for the ideas. Can be "1M", "3M", "1Y". proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary:
{
print(result["SOME_SYMBOL_WITH_NO_REASONS"]) [] Additionally, if a passed symbol is not found as a portfolio holding, the symbol will be present in the dictionary but will be valued None, i.e. print(result["SOME_SYMBOL_NOT_FOUND"]) None
5139def get_stock_mapping_alternatives( 5140 self, 5141 apikey: str, 5142 isin: Optional[str] = None, 5143 symbol: Optional[str] = None, 5144 country: Optional[str] = None, 5145 currency: Optional[str] = None, 5146 asof_date: Optional[BoostedDate] = None, 5147 proxy: Optional[str] = None, 5148 disable_verify_ssl: bool = False, 5149) -> Dict: 5150 """ 5151 Return the stock mapping for the given criteria, 5152 also suggestions for alternate matches, 5153 if the mapping is not what is wanted 5154 5155 Parameters [One of either ISIN or SYMBOL must be provided] 5156 ---------- 5157 isin: Optional[str] 5158 search by ISIN 5159 symbol: Optional[str] 5160 search by Ticker Symbol 5161 country: Optional[str] 5162 Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" 5163 currency: Optional[str] 5164 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5165 asof_date: Optional[date] 5166 as of which date to perform the search, default is today() 5167 5168 Note: country/currency filter starting with "p_" indicates 5169 only a soft preference but allows other matches 5170 5171 Returns 5172 ------- 5173 Dictionary Representing this 'MapSecurityResponse' structure: 5174 5175 class MapSecurityResponse(): 5176 stock_mapping: Optional[SecurityInfo] 5177 The mapping we would perform given your inputs 5178 5179 alternatives: Optional[List[SecurityInfo]] 5180 Alternative suggestions based on your input 5181 5182 error: Optional[str] 5183 5184 class SecurityInfo(): 5185 gbi_id: int 5186 isin: str 5187 symbol: Optional[str] 5188 country: str 5189 currency: str 5190 name: str 5191 from_date: date 5192 to_date: date 5193 is_primary_trading_item: bool 5194 5195 """ 5196 5197 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5198 return client.get_stock_mapping_alternatives( 5199 isin=isin, symbol=symbol, country=country, currency=currency, asof_date=asof_date 5200 )
Return the stock mapping for the given criteria, also suggestions for alternate matches, if the mapping is not what is wanted
Parameters [One of either ISIN or SYMBOL must be provided]
----------
isin: Optional[str]
search by ISIN
symbol: Optional[str]
search by Ticker Symbol
country: Optional[str]
Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN"
currency: Optional[str]
Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD"
asof_date: Optional[date]
as of which date to perform the search, default is today()
Note: country/currency filter starting with "p_" indicates
only a soft preference but allows other matches
Returns
Dictionary Representing this 'MapSecurityResponse' structure:
class MapSecurityResponse(): stock_mapping: Optional[SecurityInfo] The mapping we would perform given your inputs
alternatives: Optional[List[SecurityInfo]]
Alternative suggestions based on your input
error: Optional[str]
class SecurityInfo(): gbi_id: int isin: str symbol: Optional[str] country: str currency: str name: str from_date: date to_date: date is_primary_trading_item: bool
5203def getProsConsForStocks( 5204 apikey: str, 5205 model_id: Optional[str] = None, 5206 symbols: Optional[List[str]] = None, 5207 preferred_country: Optional[str] = None, 5208 preferred_currency: Optional[str] = None, 5209 proxy: Optional[str] = None, 5210 disable_verify_ssl: bool = False, 5211) -> Dict[str, Dict[str, List]]: 5212 """ 5213 Given a model ID OR a list of symbols, return pros/cons for 5214 each stock. Note that unrecognized symbols will be absent from the output. 5215 5216 Parameters 5217 ---------- 5218 apikey: str 5219 API key provided by Boosted. This key should be protected as a secret. 5220 model_id: Optional[str] 5221 UUID of a Boosted model. 5222 symbols: Optional[List[str]] 5223 List of symbols for which to fetch pros/cons. 5224 preferred_country: str 5225 The preferred country for the identifier list, to resolve 5226 abiguities. Should be a 3 character iso code. By default, will try to 5227 figure out the best match. 5228 preferred_currency: str 5229 The preferred currency for the identifier list, to resolve 5230 abiguities. Should be a 3 character iso code. By default, will try to 5231 figure out the best match. 5232 proxy: str 5233 Your organization may require the use of a proxy for access. 5234 The address of a HTTPS proxy in the format of <address>:<port>. 5235 Examples are "123.456.789:123" or "my.proxy.com:123". 5236 Do not prepend with "https://". 5237 disable_verify_ssl: bool 5238 Your networking setup may be behind a firewall which performs SSL 5239 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5240 to point to the location of a custom certificate bundle, or set this 5241 parameter to true to disable SSL verification as a workaround. 5242 5243 Returns 5244 ------- 5245 Dictionary in the following format 5246 { "SYMBOL": 5247 { 5248 "pros": [ 5249 { 5250 "summary": "Increase in service revenue", 5251 "details": "Details..." 5252 }, 5253 ], 5254 "cons": [ 5255 { 5256 "summary": "Increase in cost of vehicle sales", 5257 "details": "Details..." 5258 }, 5259 ] 5260 } 5261 } 5262 """ 5263 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5264 if symbols is None and model_id is None: 5265 raise BoostedAPIException("Must provide either a list of symbols or a model/portfolio") 5266 return client.get_pros_cons_for_stocks( 5267 symbols=symbols, 5268 model_id=model_id, 5269 preferred_country=preferred_country, 5270 preferred_currency=preferred_currency, 5271 )
Given a model ID OR a list of symbols, return pros/cons for each stock. Note that unrecognized symbols will be absent from the output.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. model_id: Optional[str] UUID of a Boosted model. symbols: Optional[List[str]] List of symbols for which to fetch pros/cons. preferred_country: str The preferred country for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. preferred_currency: str The preferred currency for the identifier list, to resolve abiguities. Should be a 3 character iso code. By default, will try to figure out the best match. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
Dictionary in the following format { "SYMBOL": { "pros": [ { "summary": "Increase in service revenue", "details": "Details..." }, ], "cons": [ { "summary": "Increase in cost of vehicle sales", "details": "Details..." }, ] } }
5277def generateTheme( 5278 apikey: str, 5279 theme_name: str, 5280 stock_universes: List[ThemeUniverse], 5281 proxy: Optional[str] = None, 5282 disable_verify_ssl: bool = False, 5283) -> str: 5284 """ 5285 The API to generate a theme for a list of stock universes. 5286 5287 Parameters 5288 ---------- 5289 apikey: str 5290 API key provided by Boosted. This key should be protected as a secret. 5291 theme_name: str 5292 The name of the theme to generate. 5293 stock_universes: List[ThemeUniverse] 5294 The universe of stocks to use for the theme. We currently support the universes in the enum 5295 class `ThemeUniverse`. 5296 proxy: str 5297 Your organization may require the use of a proxy for access. 5298 The address of a HTTPS proxy in the format of <address>:<port>. 5299 Examples are "123.456.789:123" or "my.proxy.com:123". 5300 Do not prepend with "https://". 5301 disable_verify_ssl: bool 5302 Your networking setup may be behind a firewall which performs SSL 5303 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5304 to point to the location of a custom certificate bundle, or set this 5305 parameter to true to disable SSL verification as a workaround. 5306 5307 Returns 5308 ------- 5309 a string of theme id that can be used to query the theme data later. 5310 """ 5311 if not stock_universes: 5312 raise BoostedAPIException("Must provide a list of stock universe IDs") 5313 5314 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5315 return client.generate_theme(theme_name, stock_universes)
The API to generate a theme for a list of stock universes.
Parameters
apikey: str
API key provided by Boosted. This key should be protected as a secret.
theme_name: str
The name of the theme to generate.
stock_universes: List[ThemeUniverse]
The universe of stocks to use for the theme. We currently support the universes in the enum
class ThemeUniverse
.
proxy: str
Your organization may require the use of a proxy for access.
The address of a HTTPS proxy in the format of
Returns
a string of theme id that can be used to query the theme data later.
5318def getThemesForStock( 5319 apikey: str, 5320 isin: str, 5321 currency: Optional[str] = None, 5322 country: Optional[str] = None, 5323 start_date: Optional[BoostedDate] = None, 5324 end_date: Optional[BoostedDate] = None, 5325 language: Optional[Union[str, Language]] = None, 5326 proxy: Optional[str] = None, 5327 disable_verify_ssl: bool = False, 5328) -> List[Dict]: 5329 """ 5330 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5331 5332 Parameters 5333 ---------- 5334 apikey: str 5335 API key provided by Boosted. This key should be protected as a secret. 5336 isin: str 5337 The ISIN of the stock to get themes for. 5338 currency: Optional[str] 5339 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5340 "ANY", "p_USA", "CAN" 5341 country: Optional[str] 5342 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5343 start_date & end_date: Optional[BoostedDate] 5344 The start and end date to calculate the theme importance. If not provided, the default is 5345 the past 30 days. 5346 language: Optional[str | Language] 5347 Will translate AI generated text into the given language. This may be a 5348 language in the Language enum or any language code supported by Google 5349 Translate. 5350 proxy: str 5351 Your organization may require the use of a proxy for access. 5352 The address of a HTTPS proxy in the format of <address>:<port>. 5353 Examples are "123.456.789:123" or "my.proxy.com:123". 5354 Do not prepend with "https://". 5355 disable_verify_ssl: bool 5356 Your networking setup may be behind a firewall which performs SSL 5357 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5358 to point to the location of a custom certificate bundle, or set this 5359 parameter to true to disable SSL verification as a workaround. 5360 5361 Returns 5362 ------- 5363 A list of below dictionaries 5364 { 5365 themeId: str 5366 themeName: str 5367 importanceScore: float 5368 similarityScore: float 5369 positiveThemeRelation: bool 5370 reason: String 5371 } 5372 """ 5373 if (start_date and not end_date) or (end_date and not start_date): 5374 raise BoostedAPIException("Must provide both start and end dates or neither") 5375 5376 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5377 return client.get_themes_for_stock(isin, currency, country, start_date, end_date, language)
The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs)
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin: str The ISIN of the stock to get themes for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of below dictionaries { themeId: str themeName: str importanceScore: float similarityScore: float positiveThemeRelation: bool reason: String }
5380def getThemesForStockUniverse( 5381 apikey: str, 5382 stock_universe: ThemeUniverse, 5383 start_date: Optional[BoostedDate] = None, 5384 end_date: Optional[BoostedDate] = None, 5385 language: Optional[Union[str, Language]] = None, 5386 proxy: Optional[str] = None, 5387 disable_verify_ssl: bool = False, 5388) -> List[Dict]: 5389 """ 5390 The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs) 5391 5392 Parameters 5393 ---------- 5394 apikey: str 5395 API key provided by Boosted. This key should be protected as a secret. 5396 stock_universe: ThemeUniverse 5397 The universe of stocks to fetch for themes 5398 start_date & end_date: Optional[BoostedDate] 5399 The start and end date to calculate the theme importance. If not provided, the default is 5400 the past 30 days. 5401 language: Optional[str | Language] 5402 Will translate AI generated text into the given language. This may be a 5403 language in the Language enum or any language code supported by Google 5404 Translate. 5405 proxy: str 5406 Your organization may require the use of a proxy for access. 5407 The address of a HTTPS proxy in the format of <address>:<port>. 5408 Examples are "123.456.789:123" or "my.proxy.com:123". 5409 Do not prepend with "https://". 5410 disable_verify_ssl: bool 5411 Your networking setup may be behind a firewall which performs SSL 5412 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5413 to point to the location of a custom certificate bundle, or set this 5414 parameter to true to disable SSL verification as a workaround. 5415 5416 Returns: A list of below dictionaries 5417 ------- 5418 { 5419 themeId: str 5420 themeName: str 5421 themeImportance: float 5422 volatility: float 5423 positiveStockPerformance: float 5424 negativeStockPerformance: float 5425 } 5426 """ 5427 if (start_date and not end_date) or (end_date and not start_date): 5428 raise BoostedAPIException("Must provide both start and end dates or neither") 5429 5430 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5431 return client.get_themes_for_stock_universe(stock_universe, start_date, end_date, language)
The API to generate a theme for a list of stock universes. (TODO: later we'll accept ISINs)
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. stock_universe: ThemeUniverse The universe of stocks to fetch for themes start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns: A list of below dictionaries
{ themeId: str themeName: str themeImportance: float volatility: float positiveStockPerformance: float negativeStockPerformance: float }
5434def getStockNews( 5435 apikey: str, 5436 time_horizon: NewsHorizon, 5437 isin: str, 5438 currency: Optional[str] = None, 5439 country: Optional[str] = None, 5440 language: Optional[Union[str, Language]] = None, 5441 proxy: Optional[str] = None, 5442 disable_verify_ssl: bool = False, 5443) -> Dict: 5444 """ 5445 The API to get a stock's news summary for a given time horizon, the topics summarized by these 5446 news and the corresponding news to these topics 5447 Parameters 5448 ---------- 5449 apikey: str 5450 API key provided by Boosted. This key should be protected as a secret. 5451 time_horizon: NewsHorizon 5452 The time horizon for the company's news, summary, topics 5453 isin: str 5454 The ISIN of the stock to get themes for. 5455 currency: Optional[str] 5456 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5457 "ANY", "p_USA", "CAN" 5458 country: Optional[str] 5459 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5460 language: Optional[str | Language] 5461 Will translate AI generated text into the given language. This may be a 5462 language in the Language enum or any language code supported by Google 5463 Translate. 5464 start_date & end_date: Optional[BoostedDate] 5465 The start and end date to calculate the theme importance. If not provided, the default is 5466 the past 30 days. 5467 proxy: str 5468 Your organization may require the use of a proxy for access. 5469 The address of a HTTPS proxy in the format of <address>:<port>. 5470 Examples are "123.456.789:123" or "my.proxy.com:123". 5471 Do not prepend with "https://". 5472 disable_verify_ssl: bool 5473 Your networking setup may be behind a firewall which performs SSL 5474 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5475 to point to the location of a custom certificate bundle, or set this 5476 parameter to true to disable SSL verification as a workaround. 5477 Returns 5478 ------- 5479 A nested dictionary in the following format: 5480 { 5481 summary: str 5482 topics: [ 5483 { 5484 topicId: str 5485 topicLabel: str 5486 topicDescription: str 5487 topicPolarity: str 5488 newsItems: [ 5489 { 5490 newsId: str 5491 headline: str 5492 url: str 5493 summary: str 5494 source: str 5495 publishedAt: str 5496 } 5497 ] 5498 } 5499 ] 5500 other_news_count: int 5501 } 5502 """ 5503 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5504 return client.get_stock_news(time_horizon, isin, currency, country, language)
The API to get a stock's news summary for a given time horizon, the topics summarized by these news and the corresponding news to these topics
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. time_horizon: NewsHorizon The time horizon for the company's news, summary, topics isin: str The ISIN of the stock to get themes for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A nested dictionary in the following format: { summary: str topics: [ { topicId: str topicLabel: str topicDescription: str topicPolarity: str newsItems: [ { newsId: str headline: str url: str summary: str source: str publishedAt: str } ] } ] other_news_count: int }
5507def getThemeDetails( 5508 apikey: str, 5509 theme_id: str, 5510 universe: ThemeUniverse, 5511 language: Optional[Union[str, Language]] = None, 5512 proxy: Optional[str] = None, 5513 disable_verify_ssl: bool = False, 5514) -> Dict[str, Any]: 5515 """ 5516 Returns detailed theme info for a given theme ID and universe. Theme ID's 5517 can be fetched from the getAllThemeMetadata endpoint. 5518 Parameters 5519 ---------- 5520 apikey: str 5521 API key provided by Boosted. This key should be protected as a secret. 5522 theme_id: str 5523 UUID representing either a boosted theme or a theme owned with the 5524 account associated with the api key. Theme ID's can be fetched from the 5525 getAllThemeMetadata endpoint. 5526 universe: ThemeUniverse 5527 The universe of stocks to use when showing theme details/impacts. 5528 language: Optional[str | Language] 5529 Will translate AI generated text into the given language. This may be a 5530 language in the Language enum or any language code supported by Google 5531 Translate. 5532 proxy: str 5533 Your organization may require the use of a proxy for access. 5534 The address of a HTTPS proxy in the format of <address>:<port>. 5535 Examples are "123.456.789:123" or "my.proxy.com:123". 5536 Do not prepend with "https://". 5537 disable_verify_ssl: bool 5538 Your networking setup may be behind a firewall which performs SSL 5539 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5540 to point to the location of a custom certificate bundle, or set this 5541 parameter to true to disable SSL verification as a workaround. 5542 Returns 5543 ------- 5544 A nested dictionary in the following format: 5545 { 5546 "theme_name": str, 5547 "theme_summary": str, 5548 "impacts": [ 5549 { 5550 "impact_name": str, 5551 "impact_description": str, 5552 "impact_score": float, 5553 "articles": [ 5554 { 5555 "title": str, 5556 "url": str, 5557 "source": str, 5558 "publish_date": str 5559 } 5560 ], 5561 "impact_stocks": [ 5562 { 5563 "isin": str, 5564 "name": str, 5565 "positive_impact_relation": bool 5566 } 5567 ] 5568 } 5569 ], 5570 "stocks": [ 5571 { 5572 "isin": str, 5573 "name": str, 5574 "positive_theme_relation": bool, 5575 "reason": str, 5576 "theme_stock_impact_score": float 5577 } 5578 ], 5579 "developments": [ 5580 { 5581 "name": str, 5582 "article_count": int, 5583 "date": datetime.date, 5584 "description": str, 5585 "is_major_development": bool, 5586 "sentiment": int, (-1, 0, 1) 5587 "news": [ 5588 { 5589 "headline": str, 5590 "published_at": datetime.datetime, 5591 "source": str, 5592 "url": str, 5593 } 5594 ] 5595 } 5596 ] 5597 } 5598 5599 """ 5600 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5601 return client.get_theme_details(theme_id=theme_id, universe=universe, language=language)
Returns detailed theme info for a given theme ID and universe. Theme ID's can be fetched from the getAllThemeMetadata endpoint.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. theme_id: str UUID representing either a boosted theme or a theme owned with the account associated with the api key. Theme ID's can be fetched from the getAllThemeMetadata endpoint. universe: ThemeUniverse The universe of stocks to use when showing theme details/impacts. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A nested dictionary in the following format: { "theme_name": str, "theme_summary": str, "impacts": [ { "impact_name": str, "impact_description": str, "impact_score": float, "articles": [ { "title": str, "url": str, "source": str, "publish_date": str } ], "impact_stocks": [ { "isin": str, "name": str, "positive_impact_relation": bool } ] } ], "stocks": [ { "isin": str, "name": str, "positive_theme_relation": bool, "reason": str, "theme_stock_impact_score": float } ], "developments": [ { "name": str, "article_count": int, "date": datetime.date, "description": str, "is_major_development": bool, "sentiment": int, (-1, 0, 1) "news": [ { "headline": str, "published_at": datetime.datetime, "source": str, "url": str, } ] } ] }
5604def getAllThemeMetadata( 5605 apikey: str, 5606 language: Optional[Union[str, Language]] = None, 5607 proxy: Optional[str] = None, 5608 disable_verify_ssl: bool = False, 5609) -> List[Dict[str, Any]]: 5610 """ 5611 Returns metadata about all themes owned by the account associated with the 5612 given API key. 5613 Parameters 5614 ---------- 5615 apikey: str 5616 API key provided by Boosted. This key should be protected as a secret. 5617 language: Optional[str | Language] 5618 Will translate AI generated text into the given language. This may be a 5619 language in the Language enum or any language code supported by Google 5620 Translate. 5621 proxy: str 5622 Your organization may require the use of a proxy for access. 5623 The address of a HTTPS proxy in the format of <address>:<port>. 5624 Examples are "123.456.789:123" or "my.proxy.com:123". 5625 Do not prepend with "https://". 5626 disable_verify_ssl: bool 5627 Your networking setup may be behind a firewall which performs SSL 5628 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5629 to point to the location of a custom certificate bundle, or set this 5630 parameter to true to disable SSL verification as a workaround. 5631 Returns 5632 ------- 5633 A list of dictionaries in the following format: 5634 [ 5635 { 5636 "theme_name": str, 5637 "theme_id": str, 5638 "universes": List[str] 5639 } 5640 ] 5641 5642 """ 5643 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5644 return client.get_all_theme_metadata(language=language)
Returns metadata about all themes owned by the account associated with the given API key.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of dictionaries in the following format: [ { "theme_name": str, "theme_id": str, "universes": List[str] } ]
5647def getEarningsImpactingSecurity( 5648 apikey: str, 5649 isin: str, 5650 currency: Optional[str] = None, 5651 country: Optional[str] = None, 5652 language: Optional[Union[str, Language]] = None, 5653 proxy: Optional[str] = None, 5654 disable_verify_ssl: bool = False, 5655) -> List[Dict[str, Any]]: 5656 """ 5657 Returns upcoming earnings releases that could impact the given security. 5658 Parameters 5659 ---------- 5660 apikey: str 5661 API key provided by Boosted. This key should be protected as a secret. 5662 isin: str 5663 The ISIN of the stock to get themes for. 5664 currency: Optional[str] 5665 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5666 "ANY", "p_USA", "CAN" 5667 country: Optional[str] 5668 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5669 language: Optional[str | Language] 5670 Will translate AI generated text into the given language. This may be a 5671 language in the Language enum or any language code supported by Google 5672 Translate. 5673 start_date & end_date: Optional[BoostedDate] 5674 The start and end date to calculate the theme importance. If not provided, the default is 5675 the past 30 days. 5676 proxy: str 5677 Your organization may require the use of a proxy for access. 5678 The address of a HTTPS proxy in the format of <address>:<port>. 5679 Examples are "123.456.789:123" or "my.proxy.com:123". 5680 Do not prepend with "https://". 5681 disable_verify_ssl: bool 5682 Your networking setup may be behind a firewall which performs SSL 5683 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5684 to point to the location of a custom certificate bundle, or set this 5685 parameter to true to disable SSL verification as a workaround. 5686 Returns 5687 ------- 5688 A list of dictionaries in the following format: 5689 [ 5690 { 5691 "event_date": str, 5692 "company_name": str, 5693 "symbol": str, 5694 "isin": str, 5695 "impact_reason": str 5696 } 5697 ] 5698 5699 """ 5700 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5701 return client.get_earnings_impacting_security( 5702 isin=isin, country=country, currency=currency, language=language 5703 )
Returns upcoming earnings releases that could impact the given security.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin: str The ISIN of the stock to get themes for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" language: Optional[str | Language] Will translate AI generated text into the given language. This may be a language in the Language enum or any language code supported by Google Translate. start_date & end_date: Optional[BoostedDate] The start and end date to calculate the theme importance. If not provided, the default is the past 30 days. proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A list of dictionaries in the following format: [ { "event_date": str, "company_name": str, "symbol": str, "isin": str, "impact_reason": str } ]
5706def getEarningsInsights( 5707 apikey: str, 5708 isin: str, 5709 currency: Optional[str] = None, 5710 country: Optional[str] = None, 5711 proxy: Optional[str] = None, 5712 disable_verify_ssl: bool = False, 5713) -> Dict[str, Any]: 5714 """ 5715 Returns earnings insights data for a security. This data includes summarized 5716 versions of the two most recent earnings calls, as well as a generated 5717 comparison between them. 5718 Parameters 5719 ---------- 5720 apikey: str 5721 API key provided by Boosted. This key should be protected as a secret. 5722 isin: str 5723 The ISIN of the stock to get earnings data for. 5724 currency: Optional[str] 5725 The currency of the stock to get themes for. Additionally filter by country code - ex: None, 5726 "ANY", "p_USA", "CAN" 5727 country: Optional[str] 5728 Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" 5729 proxy: str 5730 Your organization may require the use of a proxy for access. 5731 The address of a HTTPS proxy in the format of <address>:<port>. 5732 Examples are "123.456.789:123" or "my.proxy.com:123". 5733 Do not prepend with "https://". 5734 disable_verify_ssl: bool 5735 Your networking setup may be behind a firewall which performs SSL 5736 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5737 to point to the location of a custom certificate bundle, or set this 5738 parameter to true to disable SSL verification as a workaround. 5739 Returns 5740 ------- 5741 A dictionary in the following format: 5742 { 5743 "earnings_report": 5744 { 5745 "release_date": datetime.date, 5746 "quarter": int, 5747 "year": int, 5748 "details": [ 5749 {"header": str, "detail": str, "sentiment": "str"} 5750 ], 5751 "call_summary": str, 5752 "common_remarks": [ 5753 {"header": str, "detail": str, "sentiment": "str"} 5754 ], 5755 "dropped_remarks": [ 5756 {"header": str, "detail": str, "sentiment": "str"} 5757 ], 5758 "qa_summary": str, 5759 "qa_details": [ 5760 {"header": str, "detail": str, "sentiment": "str"} 5761 ], 5762 }, 5763 "prior_earnings_report": (same as above except dropped_remarks becomes new_remarks), 5764 "report_comparison": [ 5765 {"header": str, "detail": str} 5766 ] 5767 } 5768 """ 5769 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5770 return client.get_earnings_insights_for_stocks(isin=isin, currency=currency, country=country)
Returns earnings insights data for a security. This data includes summarized versions of the two most recent earnings calls, as well as a generated comparison between them.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. isin: str The ISIN of the stock to get earnings data for. currency: Optional[str] The currency of the stock to get themes for. Additionally filter by country code - ex: None, "ANY", "p_USA", "CAN" country: Optional[str] Additionally filter by currency code - ex: None, "ANY", "p_USD", "CAD" proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dictionary in the following format: { "earnings_report": { "release_date": datetime.date, "quarter": int, "year": int, "details": [ {"header": str, "detail": str, "sentiment": "str"} ], "call_summary": str, "common_remarks": [ {"header": str, "detail": str, "sentiment": "str"} ], "dropped_remarks": [ {"header": str, "detail": str, "sentiment": "str"} ], "qa_summary": str, "qa_details": [ {"header": str, "detail": str, "sentiment": "str"} ], }, "prior_earnings_report": (same as above except dropped_remarks becomes new_remarks), "report_comparison": [ {"header": str, "detail": str} ] }
5774def getPortfolioInferenceStatus( 5775 apikey: str, 5776 portfolio_id: str, 5777 inference_date: str, 5778 proxy: Optional[str] = None, 5779 disable_verify_ssl: bool = False, 5780) -> Dict[str, Any]: 5781 """ 5782 Returns the live inference status of a portfolio, or the expected finish time if it is 5783 not yet done. 5784 Parameters 5785 ---------- 5786 apikey: str 5787 API key provided by Boosted. This key should be protected as a secret. 5788 portfolio_id: str 5789 The ID of the portfolio. This comes from the URL used to access the portfolio on the screen. 5790 Will be a UUID such as "ffffffff-ffff-ffff-ffff-ffffffffffff" 5791 inference_date: str 5792 YYYY-MM-DD string, such as 2023-09-22 5793 proxy: str 5794 Your organization may require the use of a proxy for access. 5795 The address of a HTTPS proxy in the format of <address>:<port>. 5796 Examples are "123.456.789:123" or "my.proxy.com:123". 5797 Do not prepend with "https://". 5798 disable_verify_ssl: bool 5799 Your networking setup may be behind a firewall which performs SSL 5800 inspection. Either set the REQUESTS_CA_BUNDLE environment variable 5801 to point to the location of a custom certificate bundle, or set this 5802 parameter to true to disable SSL verification as a workaround. 5803 Returns 5804 ------- 5805 A dictionary in the following format if portfolio_id has successfully completed on 5806 inference_date: 5807 {"expectedFinishTimeUTC": null, "done": true} 5808 5809 And in the following format if the portfolio_id has not yet completed on inference_date: 5810 {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "done": false} 5811 5812 """ 5813 client = BoostedClient(apikey, proxy=proxy, disable_verify_ssl=disable_verify_ssl) 5814 return client.get_portfolio_inference_status( 5815 portfolio_id=portfolio_id, inference_date=inference_date 5816 )
Returns the live inference status of a portfolio, or the expected finish time if it is not yet done.
Parameters
apikey: str API key provided by Boosted. This key should be protected as a secret. portfolio_id: str The ID of the portfolio. This comes from the URL used to access the portfolio on the screen. Will be a UUID such as "ffffffff-ffff-ffff-ffff-ffffffffffff" inference_date: str YYYY-MM-DD string, such as 2023-09-22 proxy: str Your organization may require the use of a proxy for access. The address of a HTTPS proxy in the format of
:Returns
A dictionary in the following format if portfolio_id has successfully completed on inference_date: {"expectedFinishTimeUTC": null, "done": true}
And in the following format if the portfolio_id has not yet completed on inference_date: {"expectedFinishTimeUTC": "2024-04-28T12:46:10Z", "done": false}