{"id":37369,"date":"2024-11-01T09:57:02","date_gmt":"2024-11-01T09:57:02","guid":{"rendered":"http:\/\/atmokpo.com\/w\/?p=37369"},"modified":"2024-11-01T11:51:06","modified_gmt":"2024-11-01T11:51:06","slug":"automated-trading-development-in-python-basic-of-series","status":"publish","type":"post","link":"https:\/\/atmokpo.com\/w\/37369\/","title":{"rendered":"Automated Trading Development in Python, Basic of Series"},"content":{"rendered":"<p><body><\/p>\n<p>Automated trading refers to the process of executing trades in various financial assets, such as stocks, forex, and cryptocurrencies, automatically through computer programs. Today, as the first step in developing an automated trading system using Python, we will take a closer look at the basic data structure called <strong>Series<\/strong>.<\/p>\n<h2>1. What is a Series?<\/h2>\n<p>A Series is one of the data structures provided by the <strong>Pandas<\/strong> library in Python, designed to store and manipulate data in a one-dimensional array format. A Series consists of pairs of indices and values, making it very useful for data analysis and the development of automated trading algorithms.<\/p>\n<h3>1.1 Features of Series<\/h3>\n<ul>\n<li>Index: Each data point is assigned a unique label.<\/li>\n<li>Data type: Various data types can be mixed within the same Series.<\/li>\n<li>A wide range of commonly used methods are provided for easy data manipulation.<\/li>\n<\/ul>\n<h2>2. Creating a Series<\/h2>\n<p>There are several ways to create a Series. First, import the necessary library and create a Series through a simple example.<\/p>\n<h3>2.1 Creating a Series from a list<\/h3>\n<pre><code>import pandas as pd\n\n# Create a list\ndata = [1, 2, 3, 4, 5]\n\n# Create a Series\nseries_from_list = pd.Series(data)\nprint(series_from_list)<\/code><\/pre>\n<h3>2.2 Creating a Series from a dictionary<\/h3>\n<pre><code># Create a dictionary\ndata_dict = {'a': 1, 'b': 2, 'c': 3}\n\n# Create a Series\nseries_from_dict = pd.Series(data_dict)\nprint(series_from_dict)<\/code><\/pre>\n<h3>2.3 Creating a Series using a scalar value<\/h3>\n<pre><code># Create a Series with a scalar value\nseries_scalar = pd.Series(5, index=[0, 1, 2, 3, 4])\nprint(series_scalar)<\/code><\/pre>\n<h2>3. Main Methods of Series<\/h2>\n<p>Various methods are available in Series for easy data manipulation. Here are some commonly used methods.<\/p>\n<h3>3.1 Checking Data<\/h3>\n<pre><code># Check data in the Series\nprint(series_from_list.head())  # Print the first 5 data points\nprint(series_from_list.tail())  # Print the last 5 data points\nprint(series_from_list.shape)  # Print the size of the data\n<\/code><\/pre>\n<h3>3.2 Indexing and Slicing<\/h3>\n<p>A Series allows extracting specific values using indices or querying a portion of the data through slicing.<\/p>\n<pre><code># Extract value using index\nprint(series_from_list[2])  # Print the value at index 2\n\n# Slicing\nprint(series_from_list[1:4])  # Print values from index 1 to 3\n<\/code><\/pre>\n<h3>3.3 Modification and Deletion<\/h3>\n<pre><code># Change a value\nseries_from_list[0] = 10\nprint(series_from_list)\n\n# Delete a value\nseries_from_list = series_from_list.drop(4)  # Delete index 4\nprint(series_from_list)\n<\/code><\/pre>\n<h2>4. Series and Automated Trading Systems<\/h2>\n<p>Series is frequently used for storing and analyzing stock price data, moving averages, trading volume data, and more. The basic principle of automated trading is to execute buy\/sell orders when specific conditions are met. In this context, a Series is an essential data structure.<\/p>\n<h3>4.1 Real Data Example<\/h3>\n<p>For example, let&#8217;s load historical price data of a stock, store it in a Series, and implement a simple conditional trading strategy.<\/p>\n<pre><code># Price data example\nprices = [100, 102, 101, 103, 105, 107, 104, 108]\nprice_series = pd.Series(prices)\n\n# Simple conditional trading strategy\nbuy_threshold = price_series.mean()  # Average price\nbuy_signals = price_series[price_series < buy_threshold]\nprint(\"Buy Signals:\", buy_signals)\n<\/code><\/pre>\n<h2>5. Example of Using Series<\/h2>\n<p>The following is an example of conducting simple data analysis using a Series. Based on given price data, we will calculate the average, maximum, and minimum values.<\/p>\n<pre><code># Initialize data\nprices = [100, 102, 101, 103, 105, 107, 104, 108]\nprice_series = pd.Series(prices)\n\n# Data analysis\nmean_price = price_series.mean()\nmax_price = price_series.max()\nmin_price = price_series.min()\nprint(f\"Average Price: {mean_price}, Max Price: {max_price}, Min Price: {min_price}\")\n<\/code><\/pre>\n<h2>6. Conclusion<\/h2>\n<p>Today, we explored the Series in Python and confirmed that it is a fundamental data structure widely used in automated trading systems. Through Series, we can perform financial data analysis and manipulation more easily. Next time, we will discuss more complex data analysis and automated trading strategy implementation using Series.<\/p>\n<h2>7. References<\/h2>\n<ul>\n<li><a href=\"https:\/\/pandas.pydata.org\/pandas-docs\/stable\/reference\/series.html\">Pandas Series Documentation<\/a><\/li>\n<li><a href=\"https:\/\/www.jetbrains.com\/help\/pycharm\/creating-an-application.html\">Resources related to Python programming<\/a><\/li>\n<\/ul>\n<p><\/body><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Automated trading refers to the process of executing trades in various financial assets, such as stocks, forex, and cryptocurrencies, automatically through computer programs. Today, as the first step in developing an automated trading system using Python, we will take a closer look at the basic data structure called Series. 1. What is a Series? A &hellip; <a href=\"https:\/\/atmokpo.com\/w\/37369\/\" class=\"more-link\">\ub354 \ubcf4\uae30<span class=\"screen-reader-text\"> &#8220;Automated Trading Development in Python, Basic of Series&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[147],"tags":[],"class_list":["post-37369","post","type-post","status-publish","format-standard","hentry","category-python-auto-trading"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.2 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Automated Trading Development in Python, Basic of Series - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/atmokpo.com\/w\/37369\/\" \/>\n<meta property=\"og:locale\" content=\"ko_KR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Automated Trading Development in Python, Basic of Series - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"og:description\" content=\"Automated trading refers to the process of executing trades in various financial assets, such as stocks, forex, and cryptocurrencies, automatically through computer programs. Today, as the first step in developing an automated trading system using Python, we will take a closer look at the basic data structure called Series. 1. What is a Series? A &hellip; \ub354 \ubcf4\uae30 &quot;Automated Trading Development in Python, Basic of Series&quot;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/atmokpo.com\/w\/37369\/\" \/>\n<meta property=\"og:site_name\" content=\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\" \/>\n<meta property=\"article:published_time\" content=\"2024-11-01T09:57:02+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-11-01T11:51:06+00:00\" \/>\n<meta name=\"author\" content=\"root\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:site\" content=\"@bebubo4\" \/>\n<meta name=\"twitter:label1\" content=\"\uae00\uc4f4\uc774\" \/>\n\t<meta name=\"twitter:data1\" content=\"root\" \/>\n\t<meta name=\"twitter:label2\" content=\"\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04\" \/>\n\t<meta name=\"twitter:data2\" content=\"3\ubd84\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/atmokpo.com\/w\/37369\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37369\/\"},\"author\":{\"name\":\"root\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\"},\"headline\":\"Automated Trading Development in Python, Basic of Series\",\"datePublished\":\"2024-11-01T09:57:02+00:00\",\"dateModified\":\"2024-11-01T11:51:06+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37369\/\"},\"wordCount\":402,\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"articleSection\":[\"Python Auto Trading\"],\"inLanguage\":\"ko-KR\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/atmokpo.com\/w\/37369\/\",\"url\":\"https:\/\/atmokpo.com\/w\/37369\/\",\"name\":\"Automated Trading Development in Python, Basic of Series - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"isPartOf\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#website\"},\"datePublished\":\"2024-11-01T09:57:02+00:00\",\"dateModified\":\"2024-11-01T11:51:06+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/atmokpo.com\/w\/37369\/#breadcrumb\"},\"inLanguage\":\"ko-KR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/atmokpo.com\/w\/37369\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/atmokpo.com\/w\/37369\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"\ud648\",\"item\":\"https:\/\/atmokpo.com\/w\/en\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Automated Trading Development in Python, Basic of Series\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/atmokpo.com\/w\/#website\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"description\":\"\",\"publisher\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/atmokpo.com\/w\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"ko-KR\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/atmokpo.com\/w\/#organization\",\"name\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\",\"url\":\"https:\/\/atmokpo.com\/w\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"contentUrl\":\"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png\",\"width\":400,\"height\":400,\"caption\":\"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8\"},\"image\":{\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/x.com\/bebubo4\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7\",\"name\":\"root\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"ko-KR\",\"@id\":\"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g\",\"caption\":\"root\"},\"sameAs\":[\"http:\/\/atmokpo.com\/w\"],\"url\":\"https:\/\/atmokpo.com\/w\/author\/root\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Automated Trading Development in Python, Basic of Series - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/atmokpo.com\/w\/37369\/","og_locale":"ko_KR","og_type":"article","og_title":"Automated Trading Development in Python, Basic of Series - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","og_description":"Automated trading refers to the process of executing trades in various financial assets, such as stocks, forex, and cryptocurrencies, automatically through computer programs. Today, as the first step in developing an automated trading system using Python, we will take a closer look at the basic data structure called Series. 1. What is a Series? A &hellip; \ub354 \ubcf4\uae30 \"Automated Trading Development in Python, Basic of Series\"","og_url":"https:\/\/atmokpo.com\/w\/37369\/","og_site_name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","article_published_time":"2024-11-01T09:57:02+00:00","article_modified_time":"2024-11-01T11:51:06+00:00","author":"root","twitter_card":"summary_large_image","twitter_creator":"@bebubo4","twitter_site":"@bebubo4","twitter_misc":{"\uae00\uc4f4\uc774":"root","\uc608\uc0c1 \ub418\ub294 \ud310\ub3c5 \uc2dc\uac04":"3\ubd84"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/atmokpo.com\/w\/37369\/#article","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/37369\/"},"author":{"name":"root","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7"},"headline":"Automated Trading Development in Python, Basic of Series","datePublished":"2024-11-01T09:57:02+00:00","dateModified":"2024-11-01T11:51:06+00:00","mainEntityOfPage":{"@id":"https:\/\/atmokpo.com\/w\/37369\/"},"wordCount":402,"publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"articleSection":["Python Auto Trading"],"inLanguage":"ko-KR"},{"@type":"WebPage","@id":"https:\/\/atmokpo.com\/w\/37369\/","url":"https:\/\/atmokpo.com\/w\/37369\/","name":"Automated Trading Development in Python, Basic of Series - \ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","isPartOf":{"@id":"https:\/\/atmokpo.com\/w\/#website"},"datePublished":"2024-11-01T09:57:02+00:00","dateModified":"2024-11-01T11:51:06+00:00","breadcrumb":{"@id":"https:\/\/atmokpo.com\/w\/37369\/#breadcrumb"},"inLanguage":"ko-KR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/atmokpo.com\/w\/37369\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/atmokpo.com\/w\/37369\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"\ud648","item":"https:\/\/atmokpo.com\/w\/en\/"},{"@type":"ListItem","position":2,"name":"Automated Trading Development in Python, Basic of Series"}]},{"@type":"WebSite","@id":"https:\/\/atmokpo.com\/w\/#website","url":"https:\/\/atmokpo.com\/w\/","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","description":"","publisher":{"@id":"https:\/\/atmokpo.com\/w\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/atmokpo.com\/w\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"ko-KR"},{"@type":"Organization","@id":"https:\/\/atmokpo.com\/w\/#organization","name":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8","url":"https:\/\/atmokpo.com\/w\/","logo":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/","url":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","contentUrl":"https:\/\/atmokpo.com\/w\/wp-content\/uploads\/2024\/11\/logo.png","width":400,"height":400,"caption":"\ub77c\uc774\ube0c\uc2a4\ub9c8\ud2b8"},"image":{"@id":"https:\/\/atmokpo.com\/w\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/x.com\/bebubo4"]},{"@type":"Person","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/91b6b3b138fbba0efb4ae64b1abd81d7","name":"root","image":{"@type":"ImageObject","inLanguage":"ko-KR","@id":"https:\/\/atmokpo.com\/w\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/708197b41fc6435a7ce22d951b25d4a47e9e904270cb1f04682d4f025066f80c?s=96&d=mm&r=g","caption":"root"},"sameAs":["http:\/\/atmokpo.com\/w"],"url":"https:\/\/atmokpo.com\/w\/author\/root\/"}]}},"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37369","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/comments?post=37369"}],"version-history":[{"count":1,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37369\/revisions"}],"predecessor-version":[{"id":37370,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/posts\/37369\/revisions\/37370"}],"wp:attachment":[{"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/media?parent=37369"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/categories?post=37369"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/atmokpo.com\/w\/wp-json\/wp\/v2\/tags?post=37369"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}