alpaca-py-nopandas 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (62) hide show
  1. alpaca/__init__.py +2 -0
  2. alpaca/broker/__init__.py +8 -0
  3. alpaca/broker/client.py +2360 -0
  4. alpaca/broker/enums.py +528 -0
  5. alpaca/broker/models/__init__.py +7 -0
  6. alpaca/broker/models/accounts.py +347 -0
  7. alpaca/broker/models/cip.py +265 -0
  8. alpaca/broker/models/documents.py +159 -0
  9. alpaca/broker/models/funding.py +114 -0
  10. alpaca/broker/models/journals.py +71 -0
  11. alpaca/broker/models/rebalancing.py +80 -0
  12. alpaca/broker/models/trading.py +13 -0
  13. alpaca/broker/requests.py +1135 -0
  14. alpaca/common/__init__.py +6 -0
  15. alpaca/common/constants.py +13 -0
  16. alpaca/common/enums.py +64 -0
  17. alpaca/common/exceptions.py +47 -0
  18. alpaca/common/models.py +21 -0
  19. alpaca/common/requests.py +82 -0
  20. alpaca/common/rest.py +438 -0
  21. alpaca/common/types.py +7 -0
  22. alpaca/common/utils.py +89 -0
  23. alpaca/data/__init__.py +5 -0
  24. alpaca/data/enums.py +184 -0
  25. alpaca/data/historical/__init__.py +13 -0
  26. alpaca/data/historical/corporate_actions.py +76 -0
  27. alpaca/data/historical/crypto.py +299 -0
  28. alpaca/data/historical/news.py +63 -0
  29. alpaca/data/historical/option.py +230 -0
  30. alpaca/data/historical/screener.py +72 -0
  31. alpaca/data/historical/stock.py +226 -0
  32. alpaca/data/historical/utils.py +30 -0
  33. alpaca/data/live/__init__.py +11 -0
  34. alpaca/data/live/crypto.py +168 -0
  35. alpaca/data/live/news.py +62 -0
  36. alpaca/data/live/option.py +88 -0
  37. alpaca/data/live/stock.py +199 -0
  38. alpaca/data/live/websocket.py +390 -0
  39. alpaca/data/mappings.py +84 -0
  40. alpaca/data/models/__init__.py +7 -0
  41. alpaca/data/models/bars.py +83 -0
  42. alpaca/data/models/base.py +45 -0
  43. alpaca/data/models/corporate_actions.py +309 -0
  44. alpaca/data/models/news.py +90 -0
  45. alpaca/data/models/orderbooks.py +59 -0
  46. alpaca/data/models/quotes.py +78 -0
  47. alpaca/data/models/screener.py +68 -0
  48. alpaca/data/models/snapshots.py +132 -0
  49. alpaca/data/models/trades.py +204 -0
  50. alpaca/data/requests.py +580 -0
  51. alpaca/data/timeframe.py +148 -0
  52. alpaca/py.typed +0 -0
  53. alpaca/trading/__init__.py +5 -0
  54. alpaca/trading/client.py +784 -0
  55. alpaca/trading/enums.py +412 -0
  56. alpaca/trading/models.py +697 -0
  57. alpaca/trading/requests.py +604 -0
  58. alpaca/trading/stream.py +225 -0
  59. alpaca_py_nopandas-0.1.0.dist-info/LICENSE +201 -0
  60. alpaca_py_nopandas-0.1.0.dist-info/METADATA +299 -0
  61. alpaca_py_nopandas-0.1.0.dist-info/RECORD +62 -0
  62. alpaca_py_nopandas-0.1.0.dist-info/WHEEL +4 -0
alpaca/broker/enums.py ADDED
@@ -0,0 +1,528 @@
1
+ from enum import Enum
2
+
3
+
4
+ class TaxIdType(str, Enum):
5
+ """The various country specific tax identification numbers
6
+
7
+ see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#tax-id-type
8
+ """
9
+
10
+ USA_SSN = "USA_SSN"
11
+ ARG_AR_CUIT = "ARG_AR_CUIT"
12
+ AUS_TFN = "AUS_TFN"
13
+ AUS_ABN = "AUS_ABN"
14
+ BOL_NIT = "BOL_NIT"
15
+ BRA_CPF = "BRA_CPF"
16
+ CHL_RUT = "CHL_RUT"
17
+ COL_NIT = "COL_NIT"
18
+ CRI_NITE = "CRI_NITE"
19
+ DEU_TAX_ID = "DEU_TAX_ID"
20
+ DOM_RNC = "DOM_RNC"
21
+ ECU_RUC = "ECU_RUC"
22
+ FRA_SPI = "FRA_SPI"
23
+ GBR_UTR = "GBR_UTR"
24
+ GBR_NINO = "GBR_NINO"
25
+ GTM_NIT = "GTM_NIT"
26
+ HND_RTN = "HND_RTN"
27
+ HUN_TIN = "HUN_TIN"
28
+ IDN_KTP = "IDN_KTP"
29
+ IND_PAN = "IND_PAN"
30
+ ISR_TAX_ID = "ISR_TAX_ID"
31
+ ITA_TAX_ID = "ITA_TAX_ID"
32
+ JPN_TAX_ID = "JPN_TAX_ID"
33
+ MEX_RFC = "MEX_RFC"
34
+ NIC_RUC = "NIC_RUC"
35
+ NLD_TIN = "NLD_TIN"
36
+ PAN_RUC = "PAN_RUC"
37
+ PER_RUC = "PER_RUC"
38
+ PRY_RUC = "PRY_RUC"
39
+ SGP_NRIC = "SGP_NRIC"
40
+ SGP_FIN = "SGP_FIN"
41
+ SGP_ASGD = "SGP_ASGD"
42
+ SGP_ITR = "SGP_ITR"
43
+ SLV_NIT = "SLV_NIT"
44
+ SWE_TAX_ID = "SWE_TAX_ID"
45
+ URY_RUT = "URY_RUT"
46
+ VEN_RIF = "VEN_RIF"
47
+ NOT_SPECIFIED = "NOT_SPECIFIED"
48
+
49
+
50
+ class VisaType(str, Enum):
51
+ """
52
+ In addition to the following USA visa categories, we accept any sub visas of the list below.
53
+ Sub visas must be passed in according to their parent category.
54
+ Note that United States green card holders are considered permanent residents and should not pass in a visa type.
55
+
56
+ Please feel free to reach out to Alpaca if you need other tax ID types.
57
+
58
+ see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#visa-type
59
+ """
60
+
61
+ B1 = "B1"
62
+ B2 = "B2"
63
+ DACA = "DACA"
64
+ E1 = "E1"
65
+ E2 = "E2"
66
+ E3 = "E3"
67
+ F1 = "F1"
68
+ G4 = "G4"
69
+ H1B = "H1B"
70
+ J1 = "J1"
71
+ L1 = "L1"
72
+ Other = "OTHER"
73
+ O1 = "O1"
74
+ TN1 = "TN1"
75
+
76
+
77
+ class FundingSource(str, Enum):
78
+ """
79
+ Various sources of funding for brokerage accounts.
80
+
81
+ see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#funding-source
82
+ """
83
+
84
+ EMPLOYMENT_INCOME = "employment_income"
85
+ INVESTMENTS = "investments"
86
+ INHERITANCE = "inheritance"
87
+ BUSINESS_INCOME = "business_income"
88
+ SAVINGS = "savings"
89
+ FAMILY = "family"
90
+
91
+
92
+ class EmploymentStatus(str, Enum):
93
+ """
94
+ The possible employment statuses of the user
95
+
96
+ see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#employment-status
97
+ """
98
+
99
+ UNEMPLOYED = "UNEMPLOYED"
100
+ EMPLOYED = "EMPLOYED"
101
+ STUDENT = "STUDENT"
102
+ RETIRED = "RETIRED"
103
+
104
+
105
+ class AgreementType(str, Enum):
106
+ """
107
+ The types of agreements that are to be signed by the user
108
+
109
+ see https://docs.alpaca.markets/reference/createaccount
110
+ """
111
+
112
+ MARGIN = "margin_agreement"
113
+ ACCOUNT = "account_agreement"
114
+ CUSTOMER = "customer_agreement"
115
+ CRYPTO = "crypto_agreement"
116
+ OPTIONS = "options_agreement"
117
+ CUSTODIAL_CUSTOMER = "custodial_customer_agreement"
118
+
119
+
120
+ class DocumentType(str, Enum):
121
+ """
122
+ Represents the kind of document data you're uploading
123
+
124
+ please see https://alpaca.markets/docs/broker/api-references/accounts/accounts/#document-type
125
+ and https://alpaca.markets/docs/api-references/broker-api/documents/#enumuploaddocumenttype
126
+ for more info
127
+ """
128
+
129
+ IDENTITY_VERIFICATION = "identity_verification"
130
+ ADDRESS_VERIFICATION = "address_verification"
131
+ DATE_OF_BIRTH_VERIFICATION = "date_of_birth_verification"
132
+ TAX_ID_VERIFICATION = "tax_id_verification"
133
+ ACCOUNT_APPROVAL_LETTER = "account_approval_letter"
134
+ LIMITED_TRADING_AUTHORIZATION = "limited_trading_authorization"
135
+ W8BEN = "w8ben"
136
+ SOCIAL_SECURITY_NUMBER_VERIFICATION = "social_security_number_verification"
137
+ NULL = ""
138
+ CIP_RESULT = "cip_result"
139
+
140
+
141
+ class AccountEntities(str, Enum):
142
+ """
143
+ An enum representing the different fields to query for when listing accounts.
144
+
145
+ ie: asking for CONTACT and IDENTITY will have the api fill those fields when returning the list of Accounts however
146
+ other fields on the account will be nulled out where possible.
147
+ """
148
+
149
+ CONTACT = "contact"
150
+ IDENTITY = "identity"
151
+ DISCLOSURES = "disclosures"
152
+ AGREEMENTS = "agreements"
153
+ DOCUMENTS = "documents"
154
+ TRUSTED_CONTACT = "trusted_contact"
155
+ USER_CONFIGURATIONS = "trading_configurations"
156
+
157
+
158
+ class ClearingBroker(str, Enum):
159
+ """
160
+ An enum for representing what Clearing broker an Account is assigned to
161
+ """
162
+
163
+ Apex = "APEX"
164
+ ETC = "ETC"
165
+ IC = "IC"
166
+ Velox = "VELOX"
167
+ Vision = "VISION"
168
+ Self = "SELF"
169
+ Alpaca_APCA = "ALPACA_APCA"
170
+
171
+
172
+ class CIPProvider(str, Enum):
173
+ """
174
+ Enum representing what CIP provider was used.
175
+
176
+ see https://alpaca.markets/docs/api-references/broker-api/accounts/accounts/#cip-provider for more info
177
+ """
178
+
179
+ ALLOY = "alloy"
180
+ TRULIOO = "trulioo"
181
+ ONFIDO = "onfido"
182
+ VERIFF = "veriff"
183
+ JUMIO = "jumio"
184
+ GETMATI = "getmati"
185
+
186
+
187
+ class CIPStatus(str, Enum):
188
+ """
189
+ An enum representing the status of the CIPInfo
190
+
191
+ see https://alpaca.markets/docs/api-references/broker-api/accounts/accounts/#cip-status for more info
192
+ """
193
+
194
+ COMPLETE = "complete"
195
+ WITHDRAWN = "withdrawn"
196
+
197
+
198
+ class CIPResult(str, Enum):
199
+ """
200
+ see https://alpaca.markets/docs/api-references/broker-api/accounts/accounts/#cip-result for more info
201
+ """
202
+
203
+ CLEAR = "clear"
204
+ CONSIDER = "consider"
205
+
206
+
207
+ class CIPApprovalStatus(str, Enum):
208
+ """
209
+ Either `approved` or `rejected`
210
+ """
211
+
212
+ APPROVED = "approved"
213
+ REJECTED = "rejected"
214
+
215
+
216
+ class TradeDocumentType(str, Enum):
217
+ """
218
+ Represents what kind information is inside a TradeDocument
219
+
220
+ Most likely will be either of these 3:
221
+ - ACCOUNT_STATEMENT
222
+ - TRADE_CONFIRMATION
223
+ - TAX_STATEMENT
224
+
225
+ However, for older accounts with legacy documents the other legacy values might show up.
226
+
227
+ please see https://alpaca.markets/docs/api-references/broker-api/documents/#enumdocumenttype for more info
228
+ """
229
+
230
+ ACCOUNT_STATEMENT = "account_statement"
231
+ TRADE_CONFIRMATION = "trade_confirmation"
232
+ TRADE_CONFIRMATION_JSON = "trade_confirmation_json"
233
+
234
+ TAX_STATEMENT = "tax_statement"
235
+
236
+ ACCOUNT_APPLICATION = "account_application"
237
+
238
+ # Legacy Values
239
+ TAX_1099_B_DETAILS = "tax_1099_b_details"
240
+ TAX_1099_B_FORM = "tax_1099_b_form"
241
+ TAX_1099_DIV_DETAILS = "tax_1099_div_details"
242
+ TAX_1099_DIV_FORM = "tax_1099_div_form"
243
+ TAX_1099_INT_DETAILS = "tax_1099_int_details"
244
+ TAX_1099_INT_FORM = "tax_1099_int_form"
245
+ TAX_W8 = "tax_w8"
246
+
247
+
248
+ class TradeDocumentSubType(str, Enum):
249
+ """
250
+ Represents additional information for whats inside a TradeDocument in combination with a TradeDocumentType
251
+
252
+ please see https://alpaca.markets/docs/api-references/broker-api/documents/#the-document-object for more info
253
+ """
254
+
255
+ TYPE_1099_COMP = "1099-Comp"
256
+ TYPE_1042_S = "1042-S"
257
+ TYPE_480_6 = "480.6"
258
+ COURTESY_STATEMENT = "courtesy_statement"
259
+
260
+
261
+ class UploadDocumentSubType(str, Enum):
262
+ """
263
+ Represents a sub type for an UploadDocumentRequest
264
+
265
+ please see: https://alpaca.markets/docs/api-references/broker-api/documents/#enumuploaddocumentsubtype
266
+ for more info
267
+ """
268
+
269
+ ACCOUNT_APPLICATION = "Account Application"
270
+ FORM_W8_BEN = "Form W-8BEN"
271
+ PASSPORT = "passport"
272
+
273
+
274
+ class UploadDocumentMimeType(str, Enum):
275
+ """
276
+ specifies the mime type of the base64 data you're uploading as part of a UploadDocumentRequest
277
+
278
+ please see https://alpaca.markets/docs/api-references/broker-api/documents/#parameters for more info
279
+ """
280
+
281
+ PDF = "application/pdf"
282
+ PNG = "image/png"
283
+ JPEG = "image/jpeg"
284
+ JSON = "application/json"
285
+
286
+
287
+ class ACHRelationshipStatus(str, Enum):
288
+ """
289
+ Represents the state that an ACHRelationship is in.
290
+
291
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/ach/#attributes for more details
292
+ """
293
+
294
+ QUEUED = "QUEUED"
295
+ APPROVED = "APPROVED"
296
+ PENDING = "PENDING"
297
+
298
+
299
+ class BankAccountType(str, Enum):
300
+ """
301
+ Represents a kind of bank account.
302
+
303
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/ach/#attributes
304
+ """
305
+
306
+ CHECKING = "CHECKING"
307
+ SAVINGS = "SAVINGS"
308
+ # responses from plaid token connections sometimes return empty
309
+ NONE = ""
310
+
311
+
312
+ class IdentifierType(str, Enum):
313
+ """
314
+ Represents a type of bank account.
315
+
316
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/bank/#creating-a-new-bank-relationship for
317
+ more details.
318
+ """
319
+
320
+ ABA = "ABA"
321
+ BIC = "BIC"
322
+
323
+
324
+ class BankStatus(str, Enum):
325
+ """
326
+ Represents the states a Bank instance can be in.
327
+
328
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/bank/#enumbankstatus for more details.
329
+ """
330
+
331
+ QUEUED = "QUEUED"
332
+ SENT_TO_CLEARING = "SENT_TO_CLEARING"
333
+ APPROVED = "APPROVED"
334
+ CANCELED = "CANCELED"
335
+
336
+
337
+ class TransferType(str, Enum):
338
+ """
339
+ Represents the types of transfers that can be made.
340
+
341
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/transfers/#enumtransfertype for more
342
+ details.
343
+ """
344
+
345
+ ACH = "ach"
346
+ WIRE = "wire"
347
+
348
+
349
+ class TransferStatus(str, Enum):
350
+ """
351
+ Represents the states a Transfer instance can be in.
352
+
353
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/transfers/#enumtransferstatus for more
354
+ details.
355
+ """
356
+
357
+ QUEUED = "QUEUED"
358
+ APPROVAL_PENDING = "APPROVAL_PENDING"
359
+ PENDING = "PENDING"
360
+ SENT_TO_CLEARING = "SENT_TO_CLEARING"
361
+ REJECTED = "REJECTED"
362
+ CANCELED = "CANCELED"
363
+ APPROVED = "APPROVED"
364
+ SETTLED = "SETTLED"
365
+ COMPLETE = "COMPLETE"
366
+ RETURNED = "RETURNED"
367
+
368
+
369
+ class TransferDirection(str, Enum):
370
+ """
371
+ Represents the direction of the transfer.
372
+
373
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/transfers/#enumtransferdirection for more
374
+ details.
375
+ """
376
+
377
+ INCOMING = "INCOMING"
378
+ OUTGOING = "OUTGOING"
379
+
380
+
381
+ class TransferTiming(str, Enum):
382
+ """
383
+ Represents the timing of a transfer.
384
+
385
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/transfers/#creating-a-transfer-entity for
386
+ more details.
387
+ """
388
+
389
+ IMMEDIATE = "immediate"
390
+
391
+
392
+ class FeePaymentMethod(str, Enum):
393
+ """
394
+ Represents who is responsible for paying fees associated with the transfer.
395
+
396
+ Please see https://alpaca.markets/docs/api-references/broker-api/funding/transfers/#enumfeepaymentmethod for more
397
+ details.
398
+ """
399
+
400
+ USER = "user"
401
+ INVOICE = "invoice"
402
+
403
+
404
+ class JournalEntryType(str, Enum):
405
+ """
406
+ Represents the types of journals. Cash journals are transfers of cash.
407
+ Security journals are transfers of securities like stocks.
408
+
409
+ Please see https://alpaca.markets/docs/api-references/broker-api/journals/ for more details.
410
+ """
411
+
412
+ CASH = "JNLC"
413
+ SECURITY = "JNLS"
414
+
415
+
416
+ class JournalStatus(str, Enum):
417
+ """
418
+ The various states a journal can be in during its lifecycle.
419
+
420
+ Please see https://alpaca.markets/docs/api-references/broker-api/journals/#enumjournalstatus for more details.
421
+ """
422
+
423
+ QUEUED = "queued"
424
+ SENT_TO_CLEARING = "sent_to_clearing"
425
+ PENDING = "pending"
426
+ EXECUTED = "executed"
427
+ REJECTED = "rejected"
428
+ CANCELED = "canceled"
429
+ REFUSED = "refused"
430
+ CORRECT = "correct"
431
+ DELETED = "deleted"
432
+
433
+
434
+ class PortfolioStatus(str, Enum):
435
+ """
436
+ The possible values of the Portfolio status.
437
+
438
+ See https://docs.alpaca.markets/reference/get-v1-rebalancing-portfolios
439
+ """
440
+
441
+ ACTIVE = "active"
442
+ INACTIVE = "inactive"
443
+ NEEDS_ADJUSTMENT = "needs_adjustment"
444
+
445
+
446
+ class WeightType(str, Enum):
447
+ """
448
+ The possible values of the Weight type.
449
+
450
+ See https://docs.alpaca.markets/reference/post-v1-rebalancing-portfolios
451
+ """
452
+
453
+ CASH = "cash"
454
+ ASSET = "asset"
455
+
456
+
457
+ class RebalancingConditionsType(str, Enum):
458
+ """
459
+ The possible values of the Rebalancing Conditions type.
460
+
461
+ See https://docs.alpaca.markets/reference/post-v1-rebalancing-portfolios
462
+ """
463
+
464
+ DRIFT_BAND = "drift_band"
465
+ CALENDAR = "calendar"
466
+
467
+
468
+ class DriftBandSubType(str, Enum):
469
+ """
470
+ The possible values of the Rebalancing Conditions subtype for drift_band.
471
+
472
+ See https://docs.alpaca.markets/reference/post-v1-rebalancing-portfolios
473
+ """
474
+
475
+ ABSOLUTE = "absolute"
476
+ RELATIVE = "relative"
477
+
478
+
479
+ class CalendarSubType(str, Enum):
480
+ """
481
+ The possible values of the Rebalancing Conditions subtype for drift_band.
482
+
483
+ See https://docs.alpaca.markets/reference/post-v1-rebalancing-portfolios
484
+ """
485
+
486
+ WEEKLY = "weekly"
487
+ MONTHLY = "monthly"
488
+ QUARTERLY = "quarterly"
489
+ ANNUALLY = "annually"
490
+
491
+
492
+ class RunType(str, Enum):
493
+ """
494
+ The possible values of the Run type.
495
+
496
+ See https://docs.alpaca.markets/reference/post-v1-rebalancing-runs
497
+ """
498
+
499
+ FULL_REBALANCE = "full_rebalance"
500
+ INVEST_CASH = "invest_cash"
501
+
502
+
503
+ class RunInitiatedFrom(str, Enum):
504
+ """
505
+ The possible values of the initiated_from field.
506
+
507
+ See https://docs.alpaca.markets/docs/portfolio-rebalancing
508
+ """
509
+
510
+ SYSTEM = "system"
511
+ API = "api"
512
+
513
+
514
+ class RunStatus(str, Enum):
515
+ """
516
+ The possible values of the Run status.
517
+
518
+ See https://docs.alpaca.markets/reference/get-v1-rebalancing-runs
519
+ """
520
+
521
+ QUEUED = "QUEUED"
522
+ IN_PROGRESS = "IN_PROGRESS"
523
+ CANCELED = "CANCELED"
524
+ CANCELED_MID_RUN = "CANCELED_MID_RUN"
525
+ ERROR = "ERROR"
526
+ TIMEOUT = "TIMEOUT"
527
+ COMPLETED_SUCCESS = "COMPLETED_SUCCESS"
528
+ COMPLETED_ADJUSTED = "COMPLETED_ADJUSTED"
@@ -0,0 +1,7 @@
1
+ from .accounts import *
2
+ from .cip import *
3
+ from .documents import *
4
+ from .funding import *
5
+ from .trading import *
6
+ from .journals import *
7
+ from .rebalancing import *